Merge remote branch 'internal/upstream' into HEAD

This commit is contained in:
John Koleszar 2010-09-17 00:05:04 -04:00
commit 14b322e466
4 changed files with 10 additions and 201 deletions

View File

@ -1,164 +0,0 @@
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/****************************************************************************
*
* Module Title : xprintf.cpp
*
* Description : Display a printf style message on the current video frame.
*
****************************************************************************/
/****************************************************************************
* Header Files
****************************************************************************/
#include <stdio.h>
#include <stdarg.h>
#ifdef _WIN32_WCE
#include <windows.h>
#endif
#include "xprintf.h"
/****************************************************************************
*
* ROUTINE : xprintf
*
* INPUTS : const PB_INSTANCE *ppbi : Pointer to decoder instance.
* long n_pixel : Offset into buffer to write text.
* const char *format : Format string for print.
* ... : Variable length argument list.
*
* OUTPUTS : None.
*
* RETURNS : int: Size (in bytes) of the formatted text.
*
* FUNCTION : Display a printf style message on the current video frame.
*
* SPECIAL NOTES : None.
*
****************************************************************************/
int onyx_xprintf(unsigned char *ppbuffer, long n_pixel, long n_size, long n_stride, const char *format, ...)
{
BOOL b_rc;
va_list arglist;
HFONT hfont, hfonto;
int rc = 0;
char sz_formatted[256] = "";
unsigned char *p_dest = &ppbuffer[n_pixel];
#ifdef _WIN32_WCE
// Set up temporary bitmap
HDC hdc_memory = NULL;
HBITMAP hbm_temp = NULL;
HBITMAP hbm_orig = NULL;
RECT rect;
// Copy bitmap to video frame
long x;
long y;
// Format text
va_start(arglist, format);
_vsnprintf(sz_formatted, sizeof(sz_formatted), format, arglist);
va_end(arglist);
rect.left = 0;
rect.top = 0;
rect.right = 8 * strlen(sz_formatted);
rect.bottom = 8;
hdc_memory = create_compatible_dc(NULL);
if (hdc_memory == NULL)
goto Exit;
hbm_temp = create_bitmap(rect.right, rect.bottom, 1, 1, NULL);
if (hbm_temp == NULL)
goto Exit;
hbm_orig = (HBITMAP)(select_object(hdc_memory, hbm_temp));
if (!hbm_orig)
goto Exit;
// Write text into bitmap
// font?
hfont = create_font(8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, VARIABLE_PITCH | FF_SWISS, "");
if (hfont == NULL)
goto Exit;
hfonto = (HFONT)(select_object(hdc_memory, hbm_temp));
if (!hfonto)
goto Exit;
select_object(hdc_memory, hfont);
set_text_color(hdc_memory, 1);
set_bk_color(hdc_memory, 0);
set_bk_mode(hdc_memory, TRANSPARENT);
b_rc = bit_blt(hdc_memory, rect.left, rect.top, rect.right, rect.bottom, hdc_memory, rect.left, rect.top, BLACKNESS);
if (!b_rc)
goto Exit;
b_rc = ext_text_out(hdc_memory, 0, 0, ETO_CLIPPED, &rect, sz_formatted, strlen(sz_formatted), NULL);
if (!b_rc)
goto Exit;
for (y = rect.top; y < rect.bottom; ++y)
{
for (x = rect.left; x < rect.right; ++x)
{
if (get_pixel(hdc_memory, x, rect.bottom - 1 - y))
p_dest[x] = 255;
}
p_dest += n_stride;
}
rc = strlen(sz_formatted);
Exit:
if (hbm_temp != NULL)
{
if (hbm_orig != NULL)
{
select_object(hdc_memory, hbm_orig);
}
delete_object(hbm_temp);
}
if (hfont != NULL)
{
if (hfonto != NULL)
select_object(hdc_memory, hfonto);
delete_object(hfont);
}
if (hdc_memory != NULL)
delete_dc(hdc_memory);
hdc_memory = 0;
#endif
return rc;
}

View File

@ -1,33 +0,0 @@
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/****************************************************************************
*
* Module Title : xprintf.h
*
* Description : Debug print interface header file.
*
****************************************************************************/
#ifndef __INC_XPRINTF_H
#define __INC_XPRINTF_H
/****************************************************************************
* Header Files
****************************************************************************/
/****************************************************************************
* Functions
****************************************************************************/
// Display a printf style message on the current video frame
extern int onyx_xprintf(unsigned char *ppbuffer, long n_pixel, long n_size, long n_stride, const char *format, ...);
#endif

View File

@ -26,8 +26,8 @@ _int64 context_counters[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [vp8_coef
void vp8_stuff_mb(VP8_COMP *cpi, MACROBLOCKD *x, TOKENEXTRA **t) ;
void vp8_fix_contexts(MACROBLOCKD *x);
TOKENEXTRA vp8_dct_value_tokens[DCT_MAX_VALUE*2];
const TOKENEXTRA *vp8_dct_value_tokens_ptr;
TOKENVALUE vp8_dct_value_tokens[DCT_MAX_VALUE*2];
const TOKENVALUE *vp8_dct_value_tokens_ptr;
int vp8_dct_value_cost[DCT_MAX_VALUE*2];
const int *vp8_dct_value_cost_ptr;
#if 0
@ -37,7 +37,7 @@ int skip_false_count = 0;
static void fill_value_tokens()
{
TOKENEXTRA *const t = vp8_dct_value_tokens + DCT_MAX_VALUE;
TOKENVALUE *const t = vp8_dct_value_tokens + DCT_MAX_VALUE;
vp8_extra_bit_struct *const e = vp8_extra_bits;
int i = -DCT_MAX_VALUE;

View File

@ -17,6 +17,12 @@
void vp8_tokenize_initialize();
typedef struct
{
short Token;
short Extra;
} TOKENVALUE;
typedef struct
{
int Token;
@ -40,6 +46,6 @@ extern const int *vp8_dct_value_cost_ptr;
* improve cache locality, since it's needed for costing when the rest of the
* fields are not.
*/
extern const TOKENEXTRA *vp8_dct_value_tokens_ptr;
extern const TOKENVALUE *vp8_dct_value_tokens_ptr;
#endif /* tokenize_h */