[FFmpeg-cvslog] avcodec/rv10: Replace switch by LUT
Andreas Rheinhardt
git at videolan.org
Thu Oct 5 23:04:59 EEST 2023
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Oct 3 02:32:10 2023 +0200| [951bcc3c0335cfdac130a359a93c1b3e3c2a0550] | committer: Andreas Rheinhardt
avcodec/rv10: Replace switch by LUT
Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=951bcc3c0335cfdac130a359a93c1b3e3c2a0550
---
libavcodec/rv10.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 3f9d5ff242..216328ffe7 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -158,25 +158,14 @@ static int rv10_decode_picture_header(MpegEncContext *s)
static int rv20_decode_picture_header(RVDecContext *rv, int whole_size)
{
+ static const enum AVPictureType pict_types[] =
+ { AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_I /* hmm ... */,
+ AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B };
MpegEncContext *s = &rv->m;
- int seq, mb_pos, i, ret;
+ int seq, mb_pos, ret;
int rpr_max;
- i = get_bits(&s->gb, 2);
- switch (i) {
- case 0:
- s->pict_type = AV_PICTURE_TYPE_I;
- break;
- case 1:
- s->pict_type = AV_PICTURE_TYPE_I;
- break; // hmm ...
- case 2:
- s->pict_type = AV_PICTURE_TYPE_P;
- break;
- case 3:
- s->pict_type = AV_PICTURE_TYPE_B;
- break;
- }
+ s->pict_type = pict_types[get_bits(&s->gb, 2)];
if (s->low_delay && s->pict_type == AV_PICTURE_TYPE_B) {
av_log(s->avctx, AV_LOG_ERROR, "low delay B\n");
More information about the ffmpeg-cvslog
mailing list