History

Merge "Overhauling the thresholds and mixing proportions for mfqe postprocessor."

Deb Mukherjee committed 14 years ago

Commit f357e5e2 parents ac97b08 47dcd761 file · +49 −45Browse files

Unified · Split

vp8/common/postproc.c+49−45
@@ -736,7 +736,7 @@ static void multiframe_quality_enhance_block · 735 unmodified lines
736736 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
737737 };
738738 int blksizeby2 = blksize >> 1;
739− int blksizesq = blksize * blksize;
739+ int qdiff = qcurr - qprev;
740740
741741 int i, j;
742742 unsigned char *yp;
@@ -749,27 +749,28 @@ static void multiframe_quality_enhance_block · 6 unmodified lines
749749 unsigned int act, sse, sad, thr;
750750 if (blksize == 16)
751751 {
752− act = vp8_variance_var16x16(y, y_stride, VP8_ZEROS, 0, &sse);
753− sad = vp8_variance_sad16x16(y, y_stride, yd, yd_stride, 0);
752+ act = (vp8_variance_var16x16(yd, yd_stride, VP8_ZEROS, 0, &sse)+128)>>8;
753+ sad = (vp8_variance_sad16x16(y, y_stride, yd, yd_stride, 0)+128)>>8;
754754 }
755755 else if (blksize == 8)
756756 {
757− act = vp8_variance_var8x8(y, y_stride, VP8_ZEROS, 0, &sse);
758− sad = vp8_variance_sad8x8(y, y_stride, yd, yd_stride, 0);
757+ act = (vp8_variance_var8x8(yd, yd_stride, VP8_ZEROS, 0, &sse)+32)>>6;
758+ sad = (vp8_variance_sad8x8(y, y_stride, yd, yd_stride, 0)+32)>>6;
759759 }
760760 else
761761 {
762− act = vp8_variance_var4x4(y, y_stride, VP8_ZEROS, 0, &sse);
763− sad = vp8_variance_sad4x4(y, y_stride, yd, yd_stride, 0);
762+ act = (vp8_variance_var4x4(yd, yd_stride, VP8_ZEROS, 0, &sse)+8)>>4;
763+ sad = (vp8_variance_sad4x4(y, y_stride, yd, yd_stride, 0)+8)>>4;
764764 }
765−
766− thr = 6 * blksizesq + (act >> 3);
767− if (thr > 12 * blksizesq) thr = 12 * blksizesq;
768− // These thresholds should be adapted later based on qcurr and qprev
765+ /* thr = qdiff/8 + log2(act) + log4(qprev) */
766+ thr = (qdiff>>3);
767+ while (act>>=1) thr++;
768+ while (qprev>>=2) thr++;
769769 if (sad < thr)
770770 {
771771 static const int roundoff = (1 << (MFQE_PRECISION - 1));
772772 int ifactor = (sad << MFQE_PRECISION) / thr;
773+ ifactor >>= (qdiff >> 5);
773774 // TODO: SIMD optimize this section
774775 if (ifactor)
775776 {
@@ -861,41 +862,44 @@ void vp8_multiframe_quality_enhance · 85 unmodified lines
861862 if (((frame_type == INTER_FRAME &&
862863 abs(mode_info_context->mbmi.mv.as_mv.row) <= 10 &&
863864 abs(mode_info_context->mbmi.mv.as_mv.col) <= 10) ||
864− (frame_type == KEY_FRAME)) &&
865− mode_info_context->mbmi.mode != B_PRED)
866− {
867− multiframe_quality_enhance_block(16,
868− qcurr,
869− qprev,
870− y_ptr,
871− u_ptr,
872− v_ptr,
873− show->y_stride,
874− show->uv_stride,
875− yd_ptr,
876− ud_ptr,
877− vd_ptr,
878− dest->y_stride,
879− dest->uv_stride);
880− }
881− else if (mode_info_context->mbmi.mode == B_PRED)
865+ (frame_type == KEY_FRAME)))
882866 {
883− int i, j;
884− for (i=0; i<2; ++i)
885− for (j=0; j<2; ++j)
886− multiframe_quality_enhance_block(8,
887− qcurr,
888− qprev,
889− y_ptr + 8*(i*show->y_stride+j),
890− u_ptr + 4*(i*show->uv_stride+j),
891− v_ptr + 4*(i*show->uv_stride+j),
892− show->y_stride,
893− show->uv_stride,
894− yd_ptr + 8*(i*dest->y_stride+j),
895− ud_ptr + 4*(i*dest->uv_stride+j),
896− vd_ptr + 4*(i*dest->uv_stride+j),
897− dest->y_stride,
898− dest->uv_stride);
867+ if (mode_info_context->mbmi.mode == B_PRED || mode_info_context->mbmi.mode == SPLITMV)
868+ {
869+ int i, j;
870+ for (i=0; i<2; ++i)
871+ for (j=0; j<2; ++j)
872+ multiframe_quality_enhance_block(8,
873+ qcurr,
874+ qprev,
875+ y_ptr + 8*(i*show->y_stride+j),
876+ u_ptr + 4*(i*show->uv_stride+j),
877+ v_ptr + 4*(i*show->uv_stride+j),
878+ show->y_stride,
879+ show->uv_stride,
880+ yd_ptr + 8*(i*dest->y_stride+j),
881+ ud_ptr + 4*(i*dest->uv_stride+j),
882+ vd_ptr + 4*(i*dest->uv_stride+j),
883+ dest->y_stride,
884+ dest->uv_stride);
885+ }
886+ else
887+ {
888+ multiframe_quality_enhance_block(16,
889+ qcurr,
890+ qprev,
891+ y_ptr,
892+ u_ptr,
893+ v_ptr,
894+ show->y_stride,
895+ show->uv_stride,
896+ yd_ptr,
897+ ud_ptr,
898+ vd_ptr,
899+ dest->y_stride,
900+ dest->uv_stride);
901+
902+ }
899903 }
900904 else
901905 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t