diff mbox series

[FFmpeg-devel,PATCHv2,2/4] avcodec/mm: decode partial palette

Message ID 089793aaa66d4fc39083cfe4332e4b294a144db9.1719439673.git.pross@xvid.org
State New
Headers show
Series [FFmpeg-devel,PATCHv2,1/4] avcodec/mm: set audio pts proportionally to audio offset | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Peter Ross June 26, 2024, 10:08 p.m. UTC
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mmvideo.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

Andreas Rheinhardt June 26, 2024, 10:15 p.m. UTC | #1
Peter Ross:
> Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>

?

> ---
>  libavcodec/mmvideo.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c
> index 3038d9ea92..933d895f96 100644
> --- a/libavcodec/mmvideo.c
> +++ b/libavcodec/mmvideo.c
> @@ -78,13 +78,10 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
>  
>  static void mm_decode_pal(MmContext *s)
>  {
> -    int i;
> -
> -    bytestream2_skip(&s->gb, 4);
> -    for (i = 0; i < 128; i++) {
> -        s->palette[i] = 0xFFU << 24 | bytestream2_get_be24(&s->gb);
> -        s->palette[i+128] = s->palette[i]<<2;
> -    }
> +    int start = bytestream2_get_le16(&s->gb);
> +    int count = bytestream2_get_le16(&s->gb);
> +    for (int i = 0; i < count; i++)
> +        s->palette[start+i] = 0xFFU << 24 | (bytestream2_get_be24(&s->gb) << 2);
>  }
>  
>  /**
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c
index 3038d9ea92..933d895f96 100644
--- a/libavcodec/mmvideo.c
+++ b/libavcodec/mmvideo.c
@@ -78,13 +78,10 @@  static av_cold int mm_decode_init(AVCodecContext *avctx)
 
 static void mm_decode_pal(MmContext *s)
 {
-    int i;
-
-    bytestream2_skip(&s->gb, 4);
-    for (i = 0; i < 128; i++) {
-        s->palette[i] = 0xFFU << 24 | bytestream2_get_be24(&s->gb);
-        s->palette[i+128] = s->palette[i]<<2;
-    }
+    int start = bytestream2_get_le16(&s->gb);
+    int count = bytestream2_get_le16(&s->gb);
+    for (int i = 0; i < count; i++)
+        s->palette[start+i] = 0xFFU << 24 | (bytestream2_get_be24(&s->gb) << 2);
 }
 
 /**