Make vp8_adjust_mb_lf_value return the updated value rather than

manipulating it in situ via a pointer.

Change-Id: If4a87a4eccd84f39577c0e91e171245f4954c5cf
This commit is contained in:
Gaute Strokkenes 2011-02-03 19:03:49 +00:00
parent 209def2d72
commit bf5f585b0d
3 changed files with 16 additions and 15 deletions

View File

@ -263,43 +263,44 @@ void vp8_frame_init_loop_filter(loop_filter_info *lfi, int frame_type)
} }
void vp8_adjust_mb_lf_value(MACROBLOCKD *mbd, int *filter_level) int vp8_adjust_mb_lf_value(MACROBLOCKD *mbd, int filter_level)
{ {
MB_MODE_INFO *mbmi = &mbd->mode_info_context->mbmi; MB_MODE_INFO *mbmi = &mbd->mode_info_context->mbmi;
if (mbd->mode_ref_lf_delta_enabled) if (mbd->mode_ref_lf_delta_enabled)
{ {
/* Apply delta for reference frame */ /* Apply delta for reference frame */
*filter_level += mbd->ref_lf_deltas[mbmi->ref_frame]; filter_level += mbd->ref_lf_deltas[mbmi->ref_frame];
/* Apply delta for mode */ /* Apply delta for mode */
if (mbmi->ref_frame == INTRA_FRAME) if (mbmi->ref_frame == INTRA_FRAME)
{ {
/* Only the split mode BPRED has a further special case */ /* Only the split mode BPRED has a further special case */
if (mbmi->mode == B_PRED) if (mbmi->mode == B_PRED)
*filter_level += mbd->mode_lf_deltas[0]; filter_level += mbd->mode_lf_deltas[0];
} }
else else
{ {
/* Zero motion mode */ /* Zero motion mode */
if (mbmi->mode == ZEROMV) if (mbmi->mode == ZEROMV)
*filter_level += mbd->mode_lf_deltas[1]; filter_level += mbd->mode_lf_deltas[1];
/* Split MB motion mode */ /* Split MB motion mode */
else if (mbmi->mode == SPLITMV) else if (mbmi->mode == SPLITMV)
*filter_level += mbd->mode_lf_deltas[3]; filter_level += mbd->mode_lf_deltas[3];
/* All other inter motion modes (Nearest, Near, New) */ /* All other inter motion modes (Nearest, Near, New) */
else else
*filter_level += mbd->mode_lf_deltas[2]; filter_level += mbd->mode_lf_deltas[2];
} }
/* Range check */ /* Range check */
if (*filter_level > MAX_LOOP_FILTER) if (filter_level > MAX_LOOP_FILTER)
*filter_level = MAX_LOOP_FILTER; filter_level = MAX_LOOP_FILTER;
else if (*filter_level < 0) else if (filter_level < 0)
*filter_level = 0; filter_level = 0;
} }
return filter_level;
} }
@ -373,7 +374,7 @@ void vp8_loop_filter_frame
* These specified to 8th pel as they are always compared to values that are in 1/8th pel units * These specified to 8th pel as they are always compared to values that are in 1/8th pel units
* Apply any context driven MB level adjustment * Apply any context driven MB level adjustment
*/ */
vp8_adjust_mb_lf_value(mbd, &filter_level); filter_level = vp8_adjust_mb_lf_value(mbd, filter_level);
if (filter_level) if (filter_level)
{ {
@ -473,7 +474,7 @@ void vp8_loop_filter_frame_yonly
filter_level = baseline_filter_level[Segment]; filter_level = baseline_filter_level[Segment];
/* Apply any context driven MB level adjustment */ /* Apply any context driven MB level adjustment */
vp8_adjust_mb_lf_value(mbd, &filter_level); filter_level = vp8_adjust_mb_lf_value(mbd, filter_level);
if (filter_level) if (filter_level)
{ {

View File

@ -200,7 +200,7 @@ typedef struct VP8Common
} VP8_COMMON; } VP8_COMMON;
void vp8_adjust_mb_lf_value(MACROBLOCKD *mbd, int *filter_level); int vp8_adjust_mb_lf_value(MACROBLOCKD *mbd, int filter_level);
void vp8_init_loop_filter(VP8_COMMON *cm); void vp8_init_loop_filter(VP8_COMMON *cm);
void vp8_frame_init_loop_filter(loop_filter_info *lfi, int frame_type); void vp8_frame_init_loop_filter(loop_filter_info *lfi, int frame_type);
extern void vp8_loop_filter_frame(VP8_COMMON *cm, MACROBLOCKD *mbd, int filt_val); extern void vp8_loop_filter_frame(VP8_COMMON *cm, MACROBLOCKD *mbd, int filt_val);

View File

@ -320,7 +320,7 @@ THREAD_FUNCTION vp8_thread_decoding_proc(void *p_data)
* These are specified to 8th pel as they are always compared to values that are in 1/8th pel units * These are specified to 8th pel as they are always compared to values that are in 1/8th pel units
* Apply any context driven MB level adjustment * Apply any context driven MB level adjustment
*/ */
vp8_adjust_mb_lf_value(xd, &filter_level); filter_level = vp8_adjust_mb_lf_value(xd, filter_level);
} }
/* Distance of Mb to the various image edges. /* Distance of Mb to the various image edges.
@ -863,7 +863,7 @@ void vp8mt_decode_mb_rows( VP8D_COMP *pbi, MACROBLOCKD *xd)
* These are specified to 8th pel as they are always compared to values that are in 1/8th pel units * These are specified to 8th pel as they are always compared to values that are in 1/8th pel units
* Apply any context driven MB level adjustment * Apply any context driven MB level adjustment
*/ */
vp8_adjust_mb_lf_value(xd, &filter_level); filter_level = vp8_adjust_mb_lf_value(xd, filter_level);
} }
/* Distance of Mb to the various image edges. /* Distance of Mb to the various image edges.