ref: 9c2ca8c1ca87f219965f3a528190a57a1ce72da8
parent: e6c91b625eef4ef5bc2de8eab08cca69ce9e73f0
author: Deb Mukherjee <debargha@google.com>
date: Mon Jan 9 11:48:45 EST 2012
Allowing the mfqe post-processing filter to be used in conjunction with deblock or demacroblock filters. When --mfqe is used together with --demacroblock or --deblock, mfqe is applied first and then demacroblock/deblock is applied to the mfqe result. Change-Id: Id83ee01f1b4a33a116f071dcf26d59c7f3497c32
--- a/vp8/common/alloccommon.c
+++ b/vp8/common/alloccommon.c
@@ -43,6 +43,8 @@
vp8_yv12_de_alloc_frame_buffer(&oci->temp_scale_frame);
vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer);
+ if (oci->post_proc_buffer_int_used)
+ vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer_int);
vpx_free(oci->above_context);
vpx_free(oci->mip);
@@ -100,6 +102,8 @@
vp8_de_alloc_frame_buffers(oci);
return 1;
}
+
+ oci->post_proc_buffer_int_used = 0;
oci->mb_rows = height >> 4;
oci->mb_cols = width >> 4;
--- a/vp8/common/onyxc_int.h
+++ b/vp8/common/onyxc_int.h
@@ -114,6 +114,8 @@
YV12_BUFFER_CONFIG post_proc_buffer;
YV12_BUFFER_CONFIG temp_scale_frame;
+ YV12_BUFFER_CONFIG post_proc_buffer_int;
+ int post_proc_buffer_int_used;
FRAME_TYPE last_frame_type; /* Save last frame's frame type for motion search. */
FRAME_TYPE frame_type;
--- a/vp8/common/postproc.c
+++ b/vp8/common/postproc.c
@@ -797,6 +797,12 @@
}
}
+#if CONFIG_RUNTIME_CPU_DETECT
+#define RTCD_VTABLE(oci) (&(oci)->rtcd.postproc)
+#else
+#define RTCD_VTABLE(oci) NULL
+#endif
+
void vp8_multiframe_quality_enhance
(
VP8_COMMON *cm
@@ -808,12 +814,11 @@
FRAME_TYPE frame_type = cm->frame_type;
/* Point at base of Mb MODE_INFO list has motion vectors etc */
const MODE_INFO *mode_info_context = cm->mi;
+ int mb_row;
+ int mb_col;
int qcurr = cm->base_qindex;
int qprev = cm->postproc_state.last_base_qindex;
- int mb_row;
- int mb_col;
-
unsigned char *y_ptr, *u_ptr, *v_ptr;
unsigned char *yd_ptr, *ud_ptr, *vd_ptr;
@@ -896,11 +901,6 @@
}
}
-#if CONFIG_RUNTIME_CPU_DETECT
-#define RTCD_VTABLE(oci) (&(oci)->rtcd.postproc)
-#else
-#define RTCD_VTABLE(oci) NULL
-#endif
int vp8_post_proc_frame(VP8_COMMON *oci, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *ppflags)
{
int q = oci->filter_level * 10 / 6;
@@ -926,12 +926,45 @@
return 0;
}
+ /* Allocate post_proc_buffer_int if needed */
+ if ((flags & VP8D_MFQE) && !oci->post_proc_buffer_int_used)
+ {
+ if ((flags & VP8D_DEBLOCK) || (flags & VP8D_DEMACROBLOCK))
+ {
+ if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer_int, oci->Width, oci->Height, VP8BORDERINPIXELS) >= 0)
+ {
+ oci->post_proc_buffer_int_used = 1;
+ }
+ }
+ }
+
#if ARCH_X86||ARCH_X86_64
vpx_reset_mmx_state();
#endif
- if (flags & VP8D_DEMACROBLOCK)
+ if ((flags & VP8D_MFQE) &&
+ oci->current_video_frame >= 2 &&
+ oci->base_qindex - oci->postproc_state.last_base_qindex >= 10)
{
+ vp8_multiframe_quality_enhance(oci);
+ if (((flags & VP8D_DEBLOCK) || (flags & VP8D_DEMACROBLOCK)) &&
+ oci->post_proc_buffer_int_used)
+ {
+ vp8_yv12_copy_frame_ptr(&oci->post_proc_buffer, &oci->post_proc_buffer_int);
+ if (flags & VP8D_DEMACROBLOCK)
+ {
+ vp8_deblock_and_de_macro_block(&oci->post_proc_buffer_int, &oci->post_proc_buffer,
+ q + (deblock_level - 5) * 10, 1, 0, RTCD_VTABLE(oci));
+ }
+ else if (flags & VP8D_DEBLOCK)
+ {
+ vp8_deblock(&oci->post_proc_buffer_int, &oci->post_proc_buffer,
+ q, 1, 0, RTCD_VTABLE(oci));
+ }
+ }
+ }
+ else if (flags & VP8D_DEMACROBLOCK)
+ {
vp8_deblock_and_de_macro_block(oci->frame_to_show, &oci->post_proc_buffer,
q + (deblock_level - 5) * 10, 1, 0, RTCD_VTABLE(oci));
}
@@ -939,12 +972,6 @@
{
vp8_deblock(oci->frame_to_show, &oci->post_proc_buffer,
q, 1, 0, RTCD_VTABLE(oci));
- }
- else if ((flags & VP8D_MFQE) &&
- oci->current_video_frame >= 2 &&
- oci->base_qindex - oci->postproc_state.last_base_qindex >= 10)
- {
- vp8_multiframe_quality_enhance(oci);
}
else
{
--
⑨