[FFmpeg-devel] [PATCH 01/25] avcodec/photocd: Simplify parsing Huffman tables a bit

Paul B Mahol onemda at gmail.com
Sat Sep 26 13:47:25 EEST 2020


On Sat, Sep 26, 2020 at 12:27:40PM +0200, Andreas Rheinhardt wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
>  libavcodec/photocd.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 

should be ok if tested.

> diff --git a/libavcodec/photocd.c b/libavcodec/photocd.c
> index 057c9d33d4..8fd4536a65 100644
> --- a/libavcodec/photocd.c
> +++ b/libavcodec/photocd.c
> @@ -245,21 +245,20 @@ static av_noinline int decode_huff(AVCodecContext *avctx, AVFrame *frame,
>          int x2, idx;
>  
>          for (; get_bits_left(&g) > 0;) {
> -            if ((show_bits(&g, 24) & 0xfff000) == 0xfff000)
> +            if (show_bits(&g, 12) == 0xfff)
>                  break;
>              skip_bits(&g, 8);
>          }
>  
> -        shiftreg = show_bits_long(&g, 32) & 0xffffff00;
> -        while (shiftreg != 0xfffffe00) {
> +        shiftreg = show_bits(&g, 24);
> +        while (shiftreg != 0xfffffe) {
>              if (get_bits_left(&g) <= 0)
>                  return AVERROR_INVALIDDATA;
>              skip_bits(&g, 1);
> -            shiftreg = show_bits_long(&g, 32) & 0xffffff00;
> +            shiftreg = show_bits(&g, 24);
>          }
> -        skip_bits(&g, 16);
> -        y = show_bits_long(&g, 23) & 0x1fff;
> -        skip_bits(&g, 8);
> +        skip_bits(&g, 24);
> +        y = show_bits(&g, 15) & 0x1fff;
>          if (y >= height)
>              break;
>          type = get_bits(&g, 2);
> -- 
> 2.25.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list