summaryrefslogtreecommitdiff
path: root/vp8/encoder/rdopt.c
diff options
context:
space:
mode:
authorYaowu Xu <yaowu@google.com>2012-05-02 13:53:15 -0700
committerYaowu Xu <yaowu@google.com>2012-05-08 14:13:22 -0700
commit54cf1d9ad3fe7ee3d0ce843b2a640f3fcf361887 (patch)
tree92b7abad163172b6a6463ccef641e328bef01f54 /vp8/encoder/rdopt.c
parent813c6c3925186d3cc0b5fc8221d88ef2ceab878f (diff)
downloadlibvpx-54cf1d9ad3fe7ee3d0ce843b2a640f3fcf361887.tar
libvpx-54cf1d9ad3fe7ee3d0ce843b2a640f3fcf361887.tar.gz
libvpx-54cf1d9ad3fe7ee3d0ce843b2a640f3fcf361887.tar.bz2
libvpx-54cf1d9ad3fe7ee3d0ce843b2a640f3fcf361887.zip
a number of fixes to entropy stats collection
1. block types There are only three types of blocks for 8x8 transformed MBs, i.e. Y block with DC does not exist for 8x8 transformed MBs as all MB using 8x8 transform have 2nd order haar transform. This commit introduced a new macro BLOCK_TYPES_8X8 to reflect such fact. 2. context counters This commit also fixed the mixed of context_counters between 4x4 and 8x8 transformed MBs. The mixed use of the counters leads me to think the existing the context probabilities were not properly generated from 8x8 transformed MBs. 3. redundant collecting in recoding The commit also corrected the code that accumulates entropy stats by making sure stats only collected for final packing, not during the recode loop Change-Id: I029f09f8f60bd0c3240cc392ff5c6d05435e322c
Diffstat (limited to 'vp8/encoder/rdopt.c')
-rw-r--r--vp8/encoder/rdopt.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index 017a9853e..cceeb7617 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -218,26 +218,28 @@ const MV_REFERENCE_FRAME vp8_second_ref_frame_order[MAX_MODES] =
};
static void fill_token_costs(
- unsigned int c [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS],
- const vp8_prob p [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]
-)
+ unsigned int (*c)[COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS],
+ const vp8_prob (*p)[COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES],
+ int block_type_counts)
{
int i, j, k;
-
- for (i = 0; i < BLOCK_TYPES; i++)
+ for (i = 0; i < block_type_counts; i++)
for (j = 0; j < COEF_BANDS; j++)
for (k = 0; k < PREV_COEF_CONTEXTS; k++)
{
if(k == 0 && ((j > 0 && i > 0) || (j > 1 && i == 0)))
- vp8_cost_tokens_skip((int *)(c [i][j][k]), p [i][j][k], vp8_coef_tree);
+ vp8_cost_tokens_skip((int *)( c [i][j][k]),
+ p [i][j][k],
+ vp8_coef_tree);
else
-
- vp8_cost_tokens((int *)(c [i][j][k]), p [i][j][k], vp8_coef_tree);
+ vp8_cost_tokens((int *)(c [i][j][k]),
+ p [i][j][k],
+ vp8_coef_tree);
}
-
}
+
static int rd_iifactor [ 32 ] = { 4, 4, 3, 2, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -370,13 +372,14 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int QIndex)
fill_token_costs(
cpi->mb.token_costs,
- (const vp8_prob( *)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs
- );
+ (const vp8_prob( *)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs,
+ BLOCK_TYPES);
fill_token_costs(
cpi->mb.token_costs_8x8,
- (const vp8_prob( *)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs_8x8
- );
+ (const vp8_prob( *)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs_8x8,
+ BLOCK_TYPES_8X8);
+
/*rough estimate for costing*/
cpi->common.kf_ymode_probs_index = cpi->common.base_qindex>>4;
vp8_init_mode_costs(cpi);