summaryrefslogtreecommitdiff
path: root/libavcodec/smc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-03-17 22:43:32 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-03-22 02:43:04 +0100
commit7b100839330ace3b4846ee4a1fc5caf4b8f8a34e (patch)
tree5743c922bd05a372bfbe733cf7ee482153d8e55d /libavcodec/smc.c
parentab5803553b3932da3227647ae27f2e2795cc5752 (diff)
avcodec: Factor updating palette out
Because the properties of frames returned from ff_get/reget_buffer are not reset at all, lots of returned frames had palette_has_changed wrongly set to 1. This has been changed, too. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/smc.c')
-rw-r--r--libavcodec/smc.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/libavcodec/smc.c b/libavcodec/smc.c
index 33581bbf81..880bf0620e 100644
--- a/libavcodec/smc.c
+++ b/libavcodec/smc.c
@@ -35,6 +35,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "decode.h"
#include "internal.h"
#define CPAIR 2
@@ -435,8 +436,6 @@ static int smc_decode_frame(AVCodecContext *avctx,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
SmcContext *s = avctx->priv_data;
- buffer_size_t pal_size;
- const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
int ret;
int total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4);
@@ -448,12 +447,7 @@ static int smc_decode_frame(AVCodecContext *avctx,
if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
- if (pal && pal_size == AVPALETTE_SIZE) {
- s->frame->palette_has_changed = 1;
- memcpy(s->pal, pal, AVPALETTE_SIZE);
- } else if (pal) {
- av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size);
- }
+ s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
smc_decode_stream(s);