summaryrefslogtreecommitdiff
path: root/vp8/encoder
diff options
context:
space:
mode:
authorYaowu Xu <yaowu@google.com>2011-12-08 11:43:09 -0800
committerYaowu Xu <yaowu@google.com>2011-12-09 14:44:13 -0800
commitbe360d47f412424e1bf1d645860ccabdad2f3343 (patch)
tree5a4d41b8449ffe2770417ce9adc3a4de3da2cccb /vp8/encoder
parent43a059de71e73e4eefd620d684f50c8a4c7a5e1d (diff)
downloadlibvpx-be360d47f412424e1bf1d645860ccabdad2f3343.tar
libvpx-be360d47f412424e1bf1d645860ccabdad2f3343.tar.gz
libvpx-be360d47f412424e1bf1d645860ccabdad2f3343.tar.bz2
libvpx-be360d47f412424e1bf1d645860ccabdad2f3343.zip
Enabled adaptive UV intra coding for inter frames
Previously, Y-adaptive UV intra coding only enabled on key frames in UVINTRA experiment. This commit enabled the same coding for inter frames, so the encoding of UV intra modes are consistent cross all frame types. Tests on derf set showed a very small overall gain around .04%: http://www.corp.google.com/~yaowu/no_crawl/interUVintra.html The gain looks to be reasonable given inta coded MBs is only a small portion of MBs in inter frames. Change-Id: Ic6fc261923f2c253f4a0c9f8bccf4797557b9e16
Diffstat (limited to 'vp8/encoder')
-rw-r--r--vp8/encoder/bitstream.c17
-rw-r--r--vp8/encoder/modecosts.c20
-rw-r--r--vp8/encoder/onyx_if.c19
-rw-r--r--vp8/encoder/onyx_int.h10
4 files changed, 57 insertions, 9 deletions
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c
index 46498c758..c49e2bd3e 100644
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -128,13 +128,16 @@ static void update_mbintra_mode_probs(VP8_COMP *cpi)
);
}
{
+#if CONFIG_UVINTRA
+ //vp8_write_bit(w, 0);
+#else
vp8_prob Pnew [VP8_UV_MODES-1];
unsigned int bct [VP8_UV_MODES-1] [2];
-
update_mode(
w, VP8_UV_MODES, vp8_uv_mode_encodings, vp8_uv_mode_tree,
Pnew, x->fc.uv_mode_prob, bct, (unsigned int *)cpi->uv_mode_count
);
+#endif
}
}
@@ -1147,7 +1150,19 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
write_i8x8_mode(w, m->bmi[10].as_mode, pc->i8x8_mode_prob);
}
else
+ {
+#if CONFIG_UVINTRA
+ write_uv_mode(w, mi->uv_mode, pc->fc.uv_mode_prob[mode]);
+#ifdef MODE_STATS
+ if(mode!=B_PRED)
+ ++cpi->y_uv_mode_count[mode][mi->uv_mode];
+#endif
+
+#else
write_uv_mode(w, mi->uv_mode, pc->fc.uv_mode_prob);
+#endif /*CONFIG_UVINTRA*/
+
+ }
}
else
{
diff --git a/vp8/encoder/modecosts.c b/vp8/encoder/modecosts.c
index 36fea9f9f..b6f77e1a1 100644
--- a/vp8/encoder/modecosts.c
+++ b/vp8/encoder/modecosts.c
@@ -37,20 +37,28 @@ void vp8_init_mode_costs(VP8_COMP *c)
vp8_cost_tokens((int *)c->mb.inter_bmode_costs, x->fc.bmode_prob, T);
}
- vp8_cost_tokens((int *)c->mb.inter_bmode_costs, x->fc.sub_mv_ref_prob, vp8_sub_mv_ref_tree);
+ vp8_cost_tokens((int *)c->mb.inter_bmode_costs,
+ x->fc.sub_mv_ref_prob, vp8_sub_mv_ref_tree);
vp8_cost_tokens(c->mb.mbmode_cost[1], x->fc.ymode_prob, vp8_ymode_tree);
#if CONFIG_QIMODE
vp8_cost_tokens(c->mb.mbmode_cost[0],
- x->kf_ymode_prob[c->common.kf_ymode_probs_index], vp8_kf_ymode_tree);
+ x->kf_ymode_prob[c->common.kf_ymode_probs_index],
+ vp8_kf_ymode_tree);
#else
- vp8_cost_tokens(c->mb.mbmode_cost[0], x->kf_ymode_prob, vp8_kf_ymode_tree);
+ vp8_cost_tokens(c->mb.mbmode_cost[0],
+ x->kf_ymode_prob, vp8_kf_ymode_tree);
#endif
- vp8_cost_tokens(c->mb.intra_uv_mode_cost[1], x->fc.uv_mode_prob, vp8_uv_mode_tree);
#if CONFIG_UVINTRA
- vp8_cost_tokens(c->mb.intra_uv_mode_cost[0], x->kf_uv_mode_prob[VP8_YMODES-1], vp8_uv_mode_tree);
+ vp8_cost_tokens(c->mb.intra_uv_mode_cost[1],
+ x->fc.uv_mode_prob[VP8_YMODES-1], vp8_uv_mode_tree);
+ vp8_cost_tokens(c->mb.intra_uv_mode_cost[0],
+ x->kf_uv_mode_prob[VP8_YMODES-1], vp8_uv_mode_tree);
#else
- vp8_cost_tokens(c->mb.intra_uv_mode_cost[0], x->kf_uv_mode_prob, vp8_uv_mode_tree);
+ vp8_cost_tokens(c->mb.intra_uv_mode_cost[1],
+ x->fc.uv_mode_prob, vp8_uv_mode_tree);
+ vp8_cost_tokens(c->mb.intra_uv_mode_cost[0],
+ x->kf_uv_mode_prob, vp8_uv_mode_tree);
#endif
vp8_cost_tokens(c->mb.i8x8_mode_costs,
x->i8x8_mode_prob,vp8_i8x8_mode_tree);
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index f9a8f274d..0b3e83bb3 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -2591,6 +2591,12 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf)
vp8_loop_filter_init(cm);
cpi->common.error.setjmp = 0;
+
+#if CONFIG_UVINTRA
+ vp8_zero(cpi->y_uv_mode_count)
+#endif
+
+
return (VP8_PTR) cpi;
}
@@ -2698,7 +2704,7 @@ void vp8_remove_compressor(VP8_PTR *ptr)
fprintf(f, "Y: %8d, %8d, %8d, %8d, %8d, %8d\n", y_modes[0], y_modes[1], y_modes[2], y_modes[3], y_modes[4], y_modes[5]);
fprintf(f, "I8:%8d, %8d, %8d, %8d\n", i8x8_modes[0], i8x8_modes[1], i8x8_modes[2], i8x8_modes[3]);
fprintf(f, "UV:%8d, %8d, %8d, %8d\n", uv_modes[0], uv_modes[1], uv_modes[2], uv_modes[3]);
- fprintf(f, "Y-UV:\n");
+ fprintf(f, "KeyFrame Y-UV:\n");
{
int i;
for(i=0;i<VP8_YMODES;i++)
@@ -2707,6 +2713,17 @@ void vp8_remove_compressor(VP8_PTR *ptr)
uv_modes_y[i][1], uv_modes_y[i][2], uv_modes_y[i][3]);
}
}
+#if CONFIG_UVINTRA
+ fprintf(f, "Inter Y-UV:\n");
+ {
+ int i;
+ for(i=0;i<VP8_YMODES;i++)
+ {
+ fprintf(f, "%2d:%8d, %8d, %8d, %8d\n",i,cpi->y_uv_mode_count[i][0],
+ cpi->y_uv_mode_count[i][1], cpi->y_uv_mode_count[i][2], cpi->y_uv_mode_count[i][3]);
+ }
+ }
+#endif
fprintf(f, "B: ");
{
int i;
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index 9f026dc90..e2c4db6b9 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -83,7 +83,7 @@ typedef struct
int inter_b_modes[B_MODE_COUNT];
#endif
/* interframe intra mode probs */
- vp8_prob ymode_prob[VP8_YMODES-1], uv_mode_prob[VP8_UV_MODES-1];
+ vp8_prob ymode_prob[VP8_YMODES-1];
/* keyframe intra mode probs */
#if CONFIG_QIMODE
vp8_prob kf_ymode_prob[8][VP8_YMODES-1];
@@ -93,8 +93,10 @@ typedef struct
#if CONFIG_UVINTRA
vp8_prob kf_uv_mode_prob[VP8_YMODES][VP8_UV_MODES-1];
+ vp8_prob uv_mode_prob[VP8_YMODES][VP8_UV_MODES-1];
#else
vp8_prob kf_uv_mode_prob[VP8_UV_MODES-1];
+ vp8_prob uv_mode_prob[VP8_UV_MODES-1];
#endif
/* intra MB type cts this frame */
int ymode_count[VP8_YMODES], uv_mode_count[VP8_UV_MODES];
@@ -539,6 +541,12 @@ typedef struct VP8_COMP
int t8x8_count;
#endif
+#if CONFIG_UVINTRA
+ int y_uv_mode_count[VP8_YMODES][VP8_UV_MODES];
+#endif
+
+
+
unsigned char *segmentation_map;
unsigned char *last_segmentation_map;