diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-06-13 15:45:19 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-06-20 18:58:39 +0200 |
commit | 9933dfe103166c43569a3b5bd4649b2e7fcefa0a (patch) | |
tree | f41b90694153d99064f6b105a99dc6c79fd23e09 | |
parent | f793074784ae79dabc4f83b61710161b3fe3288c (diff) | |
download | ffmpeg-9933dfe103166c43569a3b5bd4649b2e7fcefa0a.tar.gz |
avcodec/h261dec: Simplify decoding motion vectors
Don't use a LUT to negate followed by a conditional ordinary
negation immediately thereafter. Instead fold the two.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/h261dec.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index 6df8588bb6..852de8d535 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -208,10 +208,6 @@ static int h261_decode_mb_skipped(H261DecContext *h, int mba1, int mba2) return 0; } -static const int mvmap[17] = { - 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16 -}; - static int decode_mv_component(GetBitContext *gb, int v) { 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) if (mv_diff < 0) return v; - mv_diff = mvmap[mv_diff]; - - if (mv_diff && !get_bits1(gb)) + if (mv_diff && get_bits1(gb)) mv_diff = -mv_diff; v += mv_diff; |