Don't use a LUT to negate followed by a conditional ordinary negation immediately thereafter. Instead fold the two.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -208,10 +208,6 @@ static int h261_decode_mb_skipped(H261DecContext *h, int mba1, int mba2) · 207 unmodified lines | ||
| 208 | 208 | return 0; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | −static const int mvmap[17] = { | |
| 212 | − 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16 | |
| 213 | −}; | |
| 214 | − | |
| 215 | 211 | static int decode_mv_component(GetBitContext *gb, int v) |
| 216 | 212 | { |
| 217 | 213 | int mv_diff = get_vlc2(gb, h261_mv_vlc, H261_MV_VLC_BITS, 2); |
| @@ -220,9 +216,7 @@ static int decode_mv_component(GetBitContext *gb, int v) · 2 unmodified lines | ||
| 220 | 216 | if (mv_diff < 0) |
| 221 | 217 | return v; |
| 222 | 218 | |
| 223 | − mv_diff = mvmap[mv_diff]; | |
| 224 | − | |
| 225 | − if (mv_diff && !get_bits1(gb)) | |
| 219 | + if (mv_diff && get_bits1(gb)) | |
| 226 | 220 | mv_diff = -mv_diff; |
| 227 | 221 | |
| 228 | 222 | v += mv_diff; |