1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/rl: Avoid branch in index lookup

This uses the same logic as the MPEG-1/2 and SpeedHQ encoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-06-14 23:53:36 +02:00
parent baccb96fce
commit ba79fff6d5

View File

@ -100,13 +100,9 @@ do { \
static inline int get_rl_index(const RLTable *rl, int last, int run, int level) static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
{ {
int index;
index = rl->index_run[last][run];
if (index >= rl->n)
return rl->n;
if (level > rl->max_level[last][run]) if (level > rl->max_level[last][run])
return rl->n; return rl->n;
return index + level - 1; return rl->index_run[last][run] + level - 1;
} }
#endif /* AVCODEC_RL_H */ #endif /* AVCODEC_RL_H */