Commit 3698c1f6 authored by Scott LaVarnway's avatar Scott LaVarnway

Removed dc_diff from MB_MODE_INFO

The dc_diff flag is used to skip loopfiltering.  Instead
of setting this flag in the decoder/encoder, we now check
for this condition in the loopfilter.

Change-Id: Ie2b9cdf9e0f4e8b932bbd36e0878c05bffd28931
parent 7a49accd
......@@ -169,9 +169,7 @@ typedef struct
unsigned char partitioning;
unsigned char mb_skip_coeff; /* does this mb has coefficients at all, 1=no coefficients, 0=need decode tokens */
unsigned char dc_diff;
unsigned char need_to_clamp_mvs;
unsigned char segment_id; /* Which set of segmentation parameters should be used for this MB */
} MB_MODE_INFO;
......
......@@ -353,6 +353,9 @@ void vp8_loop_filter_frame
for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
{
int Segment = (alt_flt_enabled) ? mbd->mode_info_context->mbmi.segment_id : 0;
int skip_lf = (mbd->mode_info_context->mbmi.mode != B_PRED &&
mbd->mode_info_context->mbmi.mode != SPLITMV &&
mbd->mode_info_context->mbmi.mb_skip_coeff);
filter_level = baseline_filter_level[Segment];
......@@ -367,14 +370,14 @@ void vp8_loop_filter_frame
if (mb_col > 0)
cm->lf_mbv(y_ptr, u_ptr, v_ptr, post->y_stride, post->uv_stride, &lfi[filter_level], cm->simpler_lpf);
if (mbd->mode_info_context->mbmi.dc_diff > 0)
if (!skip_lf)
cm->lf_bv(y_ptr, u_ptr, v_ptr, post->y_stride, post->uv_stride, &lfi[filter_level], cm->simpler_lpf);
/* don't apply across umv border */
if (mb_row > 0)
cm->lf_mbh(y_ptr, u_ptr, v_ptr, post->y_stride, post->uv_stride, &lfi[filter_level], cm->simpler_lpf);
if (mbd->mode_info_context->mbmi.dc_diff > 0)
if (!skip_lf)
cm->lf_bh(y_ptr, u_ptr, v_ptr, post->y_stride, post->uv_stride, &lfi[filter_level], cm->simpler_lpf);
}
......@@ -457,6 +460,10 @@ void vp8_loop_filter_frame_yonly
for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
{
int Segment = (alt_flt_enabled) ? mbd->mode_info_context->mbmi.segment_id : 0;
int skip_lf = (mbd->mode_info_context->mbmi.mode != B_PRED &&
mbd->mode_info_context->mbmi.mode != SPLITMV &&
mbd->mode_info_context->mbmi.mb_skip_coeff);
filter_level = baseline_filter_level[Segment];
/* Apply any context driven MB level adjustment */
......@@ -467,14 +474,14 @@ void vp8_loop_filter_frame_yonly
if (mb_col > 0)
cm->lf_mbv(y_ptr, 0, 0, post->y_stride, 0, &lfi[filter_level], 0);
if (mbd->mode_info_context->mbmi.dc_diff > 0)
if (!skip_lf)
cm->lf_bv(y_ptr, 0, 0, post->y_stride, 0, &lfi[filter_level], 0);
/* don't apply across umv border */
if (mb_row > 0)
cm->lf_mbh(y_ptr, 0, 0, post->y_stride, 0, &lfi[filter_level], 0);
if (mbd->mode_info_context->mbmi.dc_diff > 0)
if (!skip_lf)
cm->lf_bh(y_ptr, 0, 0, post->y_stride, 0, &lfi[filter_level], 0);
}
......@@ -565,6 +572,10 @@ void vp8_loop_filter_partial_frame
for (mb_col = 0; mb_col < mb_cols; mb_col++)
{
int Segment = (alt_flt_enabled) ? mbd->mode_info_context->mbmi.segment_id : 0;
int skip_lf = (mbd->mode_info_context->mbmi.mode != B_PRED &&
mbd->mode_info_context->mbmi.mode != SPLITMV &&
mbd->mode_info_context->mbmi.mb_skip_coeff);
filter_level = baseline_filter_level[Segment];
if (filter_level)
......@@ -572,12 +583,12 @@ void vp8_loop_filter_partial_frame
if (mb_col > 0)
cm->lf_mbv(y_ptr, 0, 0, post->y_stride, 0, &lfi[filter_level], 0);
if (mbd->mode_info_context->mbmi.dc_diff > 0)
if (!skip_lf)
cm->lf_bv(y_ptr, 0, 0, post->y_stride, 0, &lfi[filter_level], 0);
cm->lf_mbh(y_ptr, 0, 0, post->y_stride, 0, &lfi[filter_level], 0);
if (mbd->mode_info_context->mbmi.dc_diff > 0)
if (!skip_lf)
cm->lf_bh(y_ptr, 0, 0, post->y_stride, 0, &lfi[filter_level], 0);
}
......
......@@ -804,11 +804,14 @@ int vp8_post_proc_frame(VP8_COMMON *oci, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t
for (j = 0; j < mb_cols; j++)
{
char zz[4];
int dc_diff = !(mi[mb_index].mbmi.mode != B_PRED &&
mi[mb_index].mbmi.mode != SPLITMV &&
mi[mb_index].mbmi.mb_skip_coeff));
if (oci->frame_type == KEY_FRAME)
sprintf(zz, "a");
else
sprintf(zz, "%c", mi[mb_index].mbmi.dc_diff + '0');
sprintf(zz, "%c", dc_diff + '0');
vp8_blit_text(zz, y_ptr, post->y_stride);
mb_index ++;
......
......@@ -195,11 +195,10 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd)
clamp_mvs(xd);
}
xd->mode_info_context->mbmi.dc_diff = 1;
if (xd->mode_info_context->mbmi.mode != B_PRED && xd->mode_info_context->mbmi.mode != SPLITMV && eobtotal == 0)
eobtotal |= (xd->mode_info_context->mbmi.mode == B_PRED ||
xd->mode_info_context->mbmi.mode == SPLITMV);
if (!eobtotal)
{
xd->mode_info_context->mbmi.dc_diff = 0;
skip_recon_mb(pbi, xd);
return;
}
......
......@@ -108,12 +108,10 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int m
clamp_mvs(xd);
}
xd->mode_info_context->mbmi.dc_diff = 1;
if (xd->mode_info_context->mbmi.mode != B_PRED && xd->mode_info_context->mbmi.mode != SPLITMV && eobtotal == 0)
eobtotal |= (xd->mode_info_context->mbmi.mode == B_PRED ||
xd->mode_info_context->mbmi.mode == SPLITMV);
if (!eobtotal)
{
xd->mode_info_context->mbmi.dc_diff = 0;
/*mt_skip_recon_mb(pbi, xd, mb_row, mb_col);*/
if (xd->frame_type == KEY_FRAME || xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME)
{
......@@ -322,6 +320,7 @@ static THREAD_FUNCTION thread_decoding_proc(void *p_data)
if (pbi->common.filter_level)
{
int skip_lf;
if( mb_row != pc->mb_rows-1 )
{
/* Save decoded MB last row data for next-row decoding */
......@@ -349,6 +348,10 @@ static THREAD_FUNCTION thread_decoding_proc(void *p_data)
/* update loopfilter info */
Segment = (alt_flt_enabled) ? xd->mode_info_context->mbmi.segment_id : 0;
skip_lf = (xd->mode_info_context->mbmi.mode != B_PRED &&
xd->mode_info_context->mbmi.mode != SPLITMV &&
xd->mode_info_context->mbmi.mb_skip_coeff);
filter_level = pbi->mt_baseline_filter_level[Segment];
/* Distance of Mb to the various image edges.
* These are specified to 8th pel as they are always compared to values that are in 1/8th pel units
......@@ -362,14 +365,14 @@ static THREAD_FUNCTION thread_decoding_proc(void *p_data)
if (mb_col > 0)
pc->lf_mbv(xd->dst.y_buffer, xd->dst.u_buffer, xd->dst.v_buffer, recon_y_stride, recon_uv_stride, &lfi[filter_level], pc->simpler_lpf);
if (xd->mode_info_context->mbmi.dc_diff > 0)
if (!skip_lf)
pc->lf_bv(xd->dst.y_buffer, xd->dst.u_buffer, xd->dst.v_buffer, recon_y_stride, recon_uv_stride, &lfi[filter_level], pc->simpler_lpf);
/* don't apply across umv border */
if (mb_row > 0)
pc->lf_mbh(xd->dst.y_buffer, xd->dst.u_buffer, xd->dst.v_buffer, recon_y_stride, recon_uv_stride, &lfi[filter_level], pc->simpler_lpf);
if (xd->mode_info_context->mbmi.dc_diff > 0)
if (!skip_lf)
pc->lf_bh(xd->dst.y_buffer, xd->dst.u_buffer, xd->dst.v_buffer, recon_y_stride, recon_uv_stride, &lfi[filter_level], pc->simpler_lpf);
}
}
......@@ -810,6 +813,7 @@ void vp8mt_decode_mb_rows( VP8D_COMP *pbi, MACROBLOCKD *xd)
if (pbi->common.filter_level)
{
int skip_lf;
/* Save decoded MB last row data for next-row decoding */
if(mb_row != pc->mb_rows-1)
{
......@@ -837,6 +841,9 @@ void vp8mt_decode_mb_rows( VP8D_COMP *pbi, MACROBLOCKD *xd)
/* update loopfilter info */
Segment = (alt_flt_enabled) ? xd->mode_info_context->mbmi.segment_id : 0;
skip_lf = (xd->mode_info_context->mbmi.mode != B_PRED &&
xd->mode_info_context->mbmi.mode != SPLITMV &&
xd->mode_info_context->mbmi.mb_skip_coeff);
filter_level = pbi->mt_baseline_filter_level[Segment];
/* Distance of Mb to the various image edges.
* These are specified to 8th pel as they are always compared to values that are in 1/8th pel units
......@@ -850,14 +857,14 @@ void vp8mt_decode_mb_rows( VP8D_COMP *pbi, MACROBLOCKD *xd)
if (mb_col > 0)
pc->lf_mbv(xd->dst.y_buffer, xd->dst.u_buffer, xd->dst.v_buffer, recon_y_stride, recon_uv_stride, &lfi[filter_level], pc->simpler_lpf);
if (xd->mode_info_context->mbmi.dc_diff > 0)
if (!skip_lf)
pc->lf_bv(xd->dst.y_buffer, xd->dst.u_buffer, xd->dst.v_buffer, recon_y_stride, recon_uv_stride, &lfi[filter_level], pc->simpler_lpf);
/* don't apply across umv border */
if (mb_row > 0)
pc->lf_mbh(xd->dst.y_buffer, xd->dst.u_buffer, xd->dst.v_buffer, recon_y_stride, recon_uv_stride, &lfi[filter_level], pc->simpler_lpf);
if (xd->mode_info_context->mbmi.dc_diff > 0)
if (!skip_lf)
pc->lf_bh(xd->dst.y_buffer, xd->dst.u_buffer, xd->dst.v_buffer, recon_y_stride, recon_uv_stride, &lfi[filter_level], pc->simpler_lpf);
}
}
......
......@@ -1400,11 +1400,6 @@ int vp8cx_encode_inter_macroblock
{
if (cpi->common.mb_no_coeff_skip)
{
if (xd->mode_info_context->mbmi.mode != B_PRED && xd->mode_info_context->mbmi.mode != SPLITMV)
xd->mode_info_context->mbmi.dc_diff = 0;
else
xd->mode_info_context->mbmi.dc_diff = 1;
xd->mode_info_context->mbmi.mb_skip_coeff = 1;
cpi->skip_true_count ++;
vp8_fix_contexts(xd);
......
......@@ -938,7 +938,6 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int re
best_mbmode.uv_mode = 0;
best_mbmode.mb_skip_coeff = (cpi->common.mb_no_coeff_skip) ? 1 : 0;
best_mbmode.partitioning = 0;
best_mbmode.dc_diff = 0;
vpx_memcpy(&x->e_mbd.mode_info_context->mbmi, &best_mbmode, sizeof(MB_MODE_INFO));
vpx_memcpy(x->partition_info, &best_partition, sizeof(PARTITION_INFO));
......
......@@ -2461,7 +2461,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
best_mbmode.uv_mode = 0;
best_mbmode.mb_skip_coeff = (cpi->common.mb_no_coeff_skip) ? 1 : 0;
best_mbmode.partitioning = 0;
best_mbmode.dc_diff = 0;
vpx_memcpy(&x->e_mbd.mode_info_context->mbmi, &best_mbmode, sizeof(MB_MODE_INFO));
vpx_memcpy(x->partition_info, &best_partition, sizeof(PARTITION_INFO));
......
......@@ -224,18 +224,9 @@ void vp8_tokenize_mb(VP8_COMP *cpi, MACROBLOCKD *x, TOKENEXTRA **t)
int plane_type;
int b;
TOKENEXTRA *start = *t;
TOKENEXTRA *tp = *t;
x->mode_info_context->mbmi.dc_diff = 1;
#if 1
x->mode_info_context->mbmi.mb_skip_coeff = mb_is_skippable(x);
if (x->mode_info_context->mbmi.mb_skip_coeff)
{
cpi->skip_true_count++;
if (!cpi->common.mb_no_coeff_skip)
......@@ -245,17 +236,11 @@ void vp8_tokenize_mb(VP8_COMP *cpi, MACROBLOCKD *x, TOKENEXTRA **t)
vp8_fix_contexts(x);
}
if (x->mode_info_context->mbmi.mode != B_PRED && x->mode_info_context->mbmi.mode != SPLITMV)
x->mode_info_context->mbmi.dc_diff = 0;
else
x->mode_info_context->mbmi.dc_diff = 1;
return;
}
cpi->skip_false_count++;
#endif
#if 0
vpx_memcpy(cpi->coef_counts_backup, cpi->coef_counts, sizeof(cpi->coef_counts));
#endif
......@@ -282,42 +267,6 @@ void vp8_tokenize_mb(VP8_COMP *cpi, MACROBLOCKD *x, TOKENEXTRA **t)
A + vp8_block2above[b],
L + vp8_block2left[b], cpi);
#if 0
if (cpi->common.mb_no_coeff_skip)
{
int skip = 1;
while ((tp != *t) && skip)
{
skip = (skip && (tp->Token == DCT_EOB_TOKEN));
tp ++;
}
if (skip != x->mbmi.mb_skip_coeff)
skip += 0;
x->mbmi.mb_skip_coeff = skip;
if (x->mbmi.mb_skip_coeff == 1)
{
x->mbmi.dc_diff = 0;
//redo the coutnts
vpx_memcpy(cpi->coef_counts, cpi->coef_counts_backup, sizeof(cpi->coef_counts));
*t = start;
cpi->skip_true_count++;
//skip_true_count++;
}
else
{
cpi->skip_false_count++;
//skip_false_count++;
}
}
#endif
}
......@@ -500,13 +449,6 @@ void vp8_stuff_mb(VP8_COMP *cpi, MACROBLOCKD *x, TOKENEXTRA **t)
A + vp8_block2above[24], L + vp8_block2left[24], cpi);
plane_type = 0;
if (x->mode_info_context->mbmi.mode != B_PRED && x->mode_info_context->mbmi.mode != SPLITMV)
x->mode_info_context->mbmi.dc_diff = 0;
else
x->mode_info_context->mbmi.dc_diff = 1;
for (b = 0; b < 16; b++)
stuff1st_order_b(x->block + b, t, plane_type, x->frame_type,
A + vp8_block2above[b],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment