From 213e606752d16f51337e94431962fb5d7749c07e Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Tue, 2 Sep 2014 23:23:03 +0200 Subject: [PATCH] Replace av_unused attributes by block structures This is more portable and avoids warnings with compilers that do not properly support av_unused. --- libavcodec/faandct.c | 20 ++++++++++++-------- libavcodec/faanidct.c | 10 ++++++---- libavcodec/h264_loopfilter.c | 11 ++++++++--- libavcodec/rangecoder.h | 12 ++++++------ 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/libavcodec/faandct.c b/libavcodec/faandct.c index b1d7a145f4..4053d69db1 100644 --- a/libavcodec/faandct.c +++ b/libavcodec/faandct.c @@ -68,7 +68,6 @@ static av_always_inline void row_fdct(FLOAT temp[64], int16_t *data) FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; FLOAT tmp10, tmp11, tmp12, tmp13; FLOAT z2, z4, z11, z13; - FLOAT av_unused z5; int i; for (i=0; i<8*8; i+=8) { @@ -99,9 +98,12 @@ static av_always_inline void row_fdct(FLOAT temp[64], int16_t *data) tmp6 += tmp7; #if 0 - z5= (tmp4 - tmp6) * A5; - z2= tmp4*A2 + z5; - z4= tmp6*A4 + z5; + { + FLOAT z5; + z5 = (tmp4 - tmp6) * A5; + z2 = tmp4 * A2 + z5; + z4 = tmp6 * A4 + z5; + } #else z2= tmp4*(A2+A5) - tmp6*A5; z4= tmp6*(A4-A5) + tmp4*A5; @@ -123,7 +125,6 @@ void ff_faandct(int16_t *data) FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; FLOAT tmp10, tmp11, tmp12, tmp13; FLOAT z2, z4, z11, z13; - FLOAT av_unused z5; FLOAT temp[64]; int i; @@ -159,9 +160,12 @@ void ff_faandct(int16_t *data) tmp6 += tmp7; #if 0 - z5= (tmp4 - tmp6) * A5; - z2= tmp4*A2 + z5; - z4= tmp6*A4 + z5; + { + FLOAT z5; + z5 = (tmp4 - tmp6) * A5; + z2 = tmp4 * A2 + z5; + z4 = tmp6 * A4 + z5; + } #else z2= tmp4*(A2+A5) - tmp6*A5; z4= tmp6*(A4-A5) + tmp4*A5; diff --git a/libavcodec/faanidct.c b/libavcodec/faanidct.c index 5cacfdd2a3..2e9ce9ce1e 100644 --- a/libavcodec/faanidct.c +++ b/libavcodec/faanidct.c @@ -49,7 +49,6 @@ B7*B0/8, B7*B1/8, B7*B2/8, B7*B3/8, B7*B4/8, B7*B5/8, B7*B6/8, B7*B7/8, static inline void p8idct(int16_t data[64], FLOAT temp[64], uint8_t *dest, int stride, int x, int y, int type){ int i; - FLOAT av_unused tmp0; FLOAT s04, d04, s17, d17, s26, d26, s53, d53; FLOAT os07, os16, os25, os34; FLOAT od07, od16, od25, od34; @@ -64,9 +63,12 @@ static inline void p8idct(int16_t data[64], FLOAT temp[64], uint8_t *dest, int s od25= (s17 - s53)*(2*A4); #if 0 //these 2 are equivalent - tmp0= (d17 + d53)*(2*A2); - od34= d17*( 2*B6) - tmp0; - od16= d53*(-2*B2) + tmp0; + { + FLOAT tmp0; + tmp0 = (d17 + d53) * (2 * A2); + od34 = d17 * (2 * B6) - tmp0; + od16 = d53 * (-2 * B2) + tmp0; + } #else od34= d17*(2*(B6-A2)) - d53*(2*A2); od16= d53*(2*(A2-B2)) + d17*(2*A2); diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c index 717c22551b..a15130cb98 100644 --- a/libavcodec/h264_loopfilter.c +++ b/libavcodec/h264_loopfilter.c @@ -704,7 +704,6 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint const int mb_type = h->cur_pic.mb_type[mb_xy]; const int mvy_limit = IS_INTERLACED(mb_type) ? 2 : 4; int first_vertical_edge_done = 0; - av_unused int dir; int chroma = !(CONFIG_GRAY && (h->flags&CODEC_FLAG_GRAY)); int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); int a = 52 + h->slice_alpha_c0_offset - qp_bd_offset; @@ -815,8 +814,14 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint } #if CONFIG_SMALL - for( dir = 0; dir < 2; dir++ ) - filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, dir ? 0 : first_vertical_edge_done, a, b, chroma, dir); + { + int dir; + for (dir = 0; dir < 2; dir++) + filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, + uvlinesize, mb_xy, mb_type, mvy_limit, + dir ? 0 : first_vertical_edge_done, a, b, + chroma, dir); + } #else filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, first_vertical_edge_done, a, b, chroma, 0); filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, 0, a, b, chroma, 1); diff --git a/libavcodec/rangecoder.h b/libavcodec/rangecoder.h index ad9c81faa4..4c88169790 100644 --- a/libavcodec/rangecoder.h +++ b/libavcodec/rangecoder.h @@ -115,7 +115,6 @@ static inline void refill(RangeCoder *c) static inline int get_rac(RangeCoder *c, uint8_t *const state) { int range1 = (c->range * (*state)) >> 8; - int av_unused one_mask; c->range -= range1; #if 1 @@ -131,13 +130,14 @@ static inline int get_rac(RangeCoder *c, uint8_t *const state) return 1; } #else - one_mask = (c->range - c->low - 1) >> 31; + { + int one_mask one_mask = (c->range - c->low - 1) >> 31; - c->low -= c->range & one_mask; - c->range += (range1 - c->range) & one_mask; - - *state = c->zero_state[(*state) + (256 & one_mask)]; + c->low -= c->range & one_mask; + c->range += (range1 - c->range) & one_mask; + *state = c->zero_state[(*state) + (256 & one_mask)]; + } refill(c); return one_mask & 1;