diff mbox series

[FFmpeg-devel,3/3] avcodec/jpeglsdec: Avoid get_bits_long() where possible

Message ID AM7PR03MB6660DBFEC6762BD239509F748F4B9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit ffb000fff8f945a5b30f1df8ab1cb2e8300cdabd
Headers show
Series [FFmpeg-devel,1/3] avformat/takdec: Don't initialize get_bits context to read one value | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 5, 2022, 9:38 p.m. UTC
It is possible here, because the values of ff_log2_run used
here are actually in the range 0..15 given that run_index is
in the range 0..31.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/jpeglsdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andreas Rheinhardt Jan. 8, 2022, 1:06 p.m. UTC | #1
Andreas Rheinhardt:
> It is possible here, because the values of ff_log2_run used
> here are actually in the range 0..15 given that run_index is
> in the range 0..31.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/jpeglsdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
> index 32c0d2eb3f..269c71dc18 100644
> --- a/libavcodec/jpeglsdec.c
> +++ b/libavcodec/jpeglsdec.c
> @@ -277,7 +277,7 @@ static inline int ls_decode_line(JLSState *state, MJpegDecodeContext *s,
>              /* decode aborted run */
>              r = ff_log2_run[state->run_index[comp]];
>              if (r)
> -                r = get_bits_long(&s->gb, r);
> +                r = get_bits(&s->gb, r);
>              if (x + r * stride > w) {
>                  r = (w - x) / stride;
>              }
> 

Will apply this patch tonight unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index 32c0d2eb3f..269c71dc18 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -277,7 +277,7 @@  static inline int ls_decode_line(JLSState *state, MJpegDecodeContext *s,
             /* decode aborted run */
             r = ff_log2_run[state->run_index[comp]];
             if (r)
-                r = get_bits_long(&s->gb, r);
+                r = get_bits(&s->gb, r);
             if (x + r * stride > w) {
                 r = (w - x) / stride;
             }