1
0
Fork 0

avutil/frame: deprecate palette_has_changed

Not only this is information that relies on the concept of a sequence of
frames, which is completely out of place as a field in AVFrame, but there are
no known or intended uses of this field.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2023-05-17 22:39:57 -03:00
parent 01d9a84ef5
commit 63767b79a5
48 changed files with 267 additions and 15 deletions

View File

@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
API changes, most recent first:
2023-05-xx - xxxxxxxxxx - lavu 58 - frame.h
Deprecate AVFrame.palette_has_changed without replacement.
2023-05-xx - xxxxxxxxxx - lavc 60 - avcodec.h
Depreate AVCodecContext.ticks_per_frame in favor of
AVCodecContext.framerate (encoding) and

View File

@ -47,8 +47,6 @@ typedef struct EightBpsContext {
unsigned char planes;
unsigned char planemap[4];
uint32_t pal[256];
} EightBpsContext;
static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
@ -123,9 +121,14 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
if (avctx->bits_per_coded_sample <= 8) {
frame->palette_has_changed = ff_copy_palette(c->pal, avpkt, avctx);
memcpy (frame->data[1], c->pal, AVPALETTE_SIZE);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed =
#endif
ff_copy_palette(frame->data[1], avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
*got_frame = 1;

View File

@ -262,7 +262,11 @@ static int execute_code(AVCodecContext * avctx, int c)
AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
s->frame->pict_type = AV_PICTURE_TYPE_I;
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
set_palette((uint32_t *)s->frame->data[1]);
erase_screen(avctx);
} else if (c == 'l') {
@ -371,7 +375,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
}
s->frame->pict_type = AV_PICTURE_TYPE_I;
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
set_palette((uint32_t *)s->frame->data[1]);
if (!s->first_frame) {
erase_screen(avctx);

View File

@ -63,7 +63,11 @@ static int set_palette(BethsoftvidContext *ctx, GetByteContext *g)
palette[a] = 0xFFU << 24 | bytestream2_get_be24u(g) * 4;
palette[a] |= palette[a] >> 6 & 0x30303;
}
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
ctx->frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
return 0;
}

View File

@ -84,11 +84,19 @@ static int bfi_decode_frame(AVCodecContext *avctx, AVFrame *frame,
pal++;
}
memcpy(bfi->pal, frame->data[1], sizeof(bfi->pal));
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
} else {
frame->pict_type = AV_PICTURE_TYPE_P;
frame->flags &= ~AV_FRAME_FLAG_KEY;
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
memcpy(frame->data[1], bfi->pal, sizeof(bfi->pal));
}

View File

@ -157,7 +157,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
if ((ret = ff_get_buffer(avctx, s->frame, 0)) < 0)
return ret;
s->frame->pict_type = AV_PICTURE_TYPE_I;
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
memcpy(s->frame->data[1], s->palette, 16 * 4);
if (avctx->codec_id == AV_CODEC_ID_XBIN) {

View File

@ -251,7 +251,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
memcpy(frame->data[1], c->pal, AVPALETTE_SIZE);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = type & BMV_PALETTE;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
outptr = frame->data[0];
srcptr = c->frame;

View File

@ -245,7 +245,11 @@ static int pix_decode_frame(AVCodecContext *avctx, AVFrame *frame,
*pal_out++ = (0xFFU << 24) | bytestream2_get_be32u(&gb);
bytestream2_skip(&gb, 8);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
chunk_type = bytestream2_get_be32(&gb);
} else if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
@ -257,7 +261,11 @@ static int pix_decode_frame(AVCodecContext *avctx, AVFrame *frame,
"Using default palette, colors might be off.\n");
memcpy(pal_out, std_pal_table, sizeof(uint32_t) * 256);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
data_len = bytestream2_get_be32(&gb);

View File

@ -246,7 +246,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
for (i = 0; i < 256; i++) {
palette[i] = 0xFFU << 24 | bytestream2_get_be24(&gb);
}
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
newpic->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
} else {
if (oldpic->data[1])
memcpy(newpic->data[1], oldpic->data[1], 256 * 4);

View File

@ -125,7 +125,11 @@ static void cdg_load_palette(CDGraphicsContext *cc, uint8_t *data, int low)
b = ((color ) & 0x000F) * 17;
palette[i + array_offset] = (uint32_t)cc->alpha[i + array_offset] << 24 | r << 16 | g << 8 | b;
}
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
cc->frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
static int cdg_tile_block(CDGraphicsContext *cc, uint8_t *data, int b)

View File

@ -384,7 +384,11 @@ static int cdtoons_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
}
/* first palette entry indicates transparency */
c->pal[0] = 0;
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
c->frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
}

View File

@ -476,7 +476,14 @@ static int cinepak_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return ret;
if (s->palette_video) {
s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed =
#endif
ff_copy_palette(s->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
if ((ret = cinepak_decode(s)) < 0) {

View File

@ -651,7 +651,11 @@ static int dds_decode(AVCodecContext *avctx, AVFrame *frame,
((unsigned)frame->data[1][3+i*4]<<24)
);
}
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (bytestream2_get_bytes_left(gbc) < frame->height * frame->width / 2) {
av_log(avctx, AV_LOG_ERROR, "Buffer is too small (%d < %d).\n",
@ -682,7 +686,11 @@ static int dds_decode(AVCodecContext *avctx, AVFrame *frame,
((unsigned)frame->data[1][3+i*4]<<24)
);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
if (bytestream2_get_bytes_left(gbc) < frame->height * linesize) {

View File

@ -367,7 +367,11 @@ static int dfa_decode_frame(AVCodecContext *avctx, AVFrame *frame,
s->pal[i] = bytestream2_get_be24(&gb) << 2;
s->pal[i] |= 0xFFU << 24 | (s->pal[i] >> 6) & 0x30303;
}
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
} else if (chunk_type <= 9) {
if (decoder[chunk_type - 2](&gb, s->frame_buf, avctx->width, avctx->height)) {
av_log(avctx, AV_LOG_ERROR, "Error decoding %s chunk\n",

View File

@ -293,7 +293,11 @@ static int cinvideo_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return res;
memcpy(cin->frame->data[1], cin->palette, sizeof(cin->palette));
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
cin->frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
for (y = 0; y < cin->avctx->height; ++y)
memcpy(cin->frame->data[0] + (cin->avctx->height - 1 - y) * cin->frame->linesize[0],
cin->bitmap_table[CIN_CUR_BMP] + y * cin->avctx->width,

View File

@ -230,7 +230,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
memcpy(frame->data[1], c->pal, AVPALETTE_SIZE);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = pc;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
outptr = frame->data[0];
srcptr = c->decomp_buf;

View File

@ -473,7 +473,11 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
/* make the palette available on the way out */
memcpy(s->frame->data[1], s->palette, AVPALETTE_SIZE);
if (s->new_palette) {
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
s->new_palette = 0;
}

View File

@ -181,7 +181,11 @@ static int gem_decode_frame(AVCodecContext *avctx, AVFrame *p,
p->pict_type = AV_PICTURE_TYPE_I;
p->flags |= AV_FRAME_FLAG_KEY;
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
p->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
palette = (uint32_t *)p->data[1];
if (tag == AV_RB32("STTT")) {

View File

@ -224,7 +224,14 @@ static int idcin_decode_frame(AVCodecContext *avctx, AVFrame *frame,
if (idcin_decode_vlcs(s, frame))
return AVERROR_INVALIDDATA;
frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed =
#endif
ff_copy_palette(s->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_ENABLE_DEPRECATION_WARNINGS
#endif
/* make the palette available on the way out */
memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);

View File

@ -58,11 +58,19 @@ static int imx_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return ret;
if (ff_copy_palette(imx->pal, avpkt, avctx)) {
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
frame->flags |= AV_FRAME_FLAG_KEY;
} else {
frame->flags &= ~AV_FRAME_FLAG_KEY;
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
bytestream2_init(&gb, avpkt->data, avpkt->size);

View File

@ -1315,7 +1315,14 @@ static int ipvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame,
return ret;
if (!s->is_16bpp) {
frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed =
#endif
ff_copy_palette(s->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
switch (frame_format) {

View File

@ -37,7 +37,9 @@ typedef struct JvContext {
BlockDSPContext bdsp;
AVFrame *frame;
uint32_t palette[AVPALETTE_COUNT];
#if FF_API_PALETTE_HAS_CHANGED
int palette_has_changed;
#endif
} JvContext;
static av_cold int decode_init(AVCodecContext *avctx)
@ -207,14 +209,20 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
s->palette[i] = 0xFFU << 24 | pal << 2 | ((pal >> 4) & 0x30303);
buf += 3;
}
#if FF_API_PALETTE_HAS_CHANGED
s->palette_has_changed = 1;
#endif
}
if (video_size) {
s->frame->flags |= AV_FRAME_FLAG_KEY;
s->frame->pict_type = AV_PICTURE_TYPE_I;
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed = s->palette_has_changed;
s->palette_has_changed = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
memcpy(s->frame->data[1], s->palette, AVPALETTE_SIZE);
if ((ret = av_frame_ref(rframe, s->frame)) < 0)

View File

@ -273,7 +273,14 @@ static int decode_frame(AVCodecContext * avctx, AVFrame *frame,
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
frame->palette_has_changed = ff_copy_palette(ctx->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed =
#endif
ff_copy_palette(ctx->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_ENABLE_DEPRECATION_WARNINGS
#endif
header = bytestream2_get_byte(&ctx->g);
@ -296,7 +303,11 @@ static int decode_frame(AVCodecContext * avctx, AVFrame *frame,
}
if (header & KMVC_PALETTE) {
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
// palette starts from index 1 and has 127 entries
for (i = 1; i <= ctx->palsize; i++) {
ctx->pal[i] = 0xFFU << 24 | bytestream2_get_be24(&ctx->g);
@ -305,7 +316,11 @@ static int decode_frame(AVCodecContext * avctx, AVFrame *frame,
if (ctx->setpal) {
ctx->setpal = 0;
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
/* make the palette available on the way out */

View File

@ -150,7 +150,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
if (pal && size == AVPALETTE_SIZE) {
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
for (j = 0; j < 256; j++)
s->pal[j] = 0xFF000000 | AV_RL32(pal + j * 4);
} else if (pal) {

View File

@ -95,7 +95,14 @@ static int msrle_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return ret;
if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) {
s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed =
#endif
ff_copy_palette(s->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_ENABLE_DEPRECATION_WARNINGS
#endif
/* make the palette available */
memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE);

View File

@ -178,7 +178,11 @@ static int mss1_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if (c->corrupted)
return AVERROR_INVALIDDATA;
memcpy(ctx->pic->data[1], c->pal, AVPALETTE_SIZE);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
ctx->pic->palette_has_changed = pal_changed;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if ((ret = av_frame_ref(rframe, ctx->pic)) < 0)
return ret;

View File

@ -312,7 +312,14 @@ static int msvideo1_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return ret;
if (s->mode_8bit) {
s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed =
#endif
ff_copy_palette(s->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
if (s->mode_8bit)

View File

@ -327,7 +327,11 @@ static int paf_video_decode(AVCodecContext *avctx, AVFrame *rframe,
b = b << 2 | b >> 4;
*out++ = (0xFFU << 24) | (r << 16) | (g << 8) | b;
}
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
c->pic->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
c->dirty[c->current_frame] = 1;

View File

@ -191,7 +191,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
return ret;
memset(frame->data[0], 0, s->height * frame->linesize[0]);
frame->pict_type = AV_PICTURE_TYPE_I;
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
pos_after_pal = bytestream2_tell(&s->g) + esize;
palette = (uint32_t*)frame->data[1];

View File

@ -532,7 +532,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
}
if (s->color_mode == PSD_INDEXED) {
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
picture->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
memcpy(picture->data[1], s->palette, AVPALETTE_SIZE);
}

View File

@ -384,7 +384,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
ret = parse_palette(avctx, &gbc, (uint32_t *)p->data[1], colors, flags & 0x8000);
if (ret < 0)
return ret;
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
p->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
/* jump to image data */
bytestream2_skip(&gbc, 18);

View File

@ -297,7 +297,14 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
}
/* make the palette available on the way out */
p->palette_has_changed = ff_copy_palette(a->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
p->palette_has_changed =
#endif
ff_copy_palette(a->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_ENABLE_DEPRECATION_WARNINGS
#endif
memcpy(p->data[1], a->pal, AVPALETTE_SIZE);
av_frame_unref(ref);

View File

@ -537,7 +537,14 @@ static int qtrle_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
}
if(has_palette) {
s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed =
#endif
ff_copy_palette(s->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_ENABLE_DEPRECATION_WARNINGS
#endif
/* make the palette available on the way out */
memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE);

View File

@ -373,7 +373,11 @@ static int raw_decode(AVCodecContext *avctx, AVFrame *frame,
}
if (ff_copy_palette(context->palette->data, avpkt, avctx)) {
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
} else if (context->is_nut_pal8) {
int vid_size = avctx->width * avctx->height;
int pal_size = avpkt->size - vid_size;
@ -381,7 +385,11 @@ static int raw_decode(AVCodecContext *avctx, AVFrame *frame,
if (avpkt->size > vid_size && pal_size <= AVPALETTE_SIZE) {
const uint8_t *pal = avpkt->data + vid_size;
memcpy(context->palette->data, pal, pal_size);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
}
}

View File

@ -346,7 +346,14 @@ static int rscc_decode_frame(AVCodecContext *avctx, AVFrame *frame,
/* Palette handling */
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
frame->palette_has_changed = ff_copy_palette(ctx->palette, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed =
#endif
ff_copy_palette(ctx->palette, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_ENABLE_DEPRECATION_WARNINGS
#endif
memcpy(frame->data[1], ctx->palette, AVPALETTE_SIZE);
}
// We only return a picture when enough of it is undamaged, this avoids copying nearly broken frames around

View File

@ -497,7 +497,11 @@ static int sga_decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
frame->pict_type = AV_PICTURE_TYPE_I;
frame->flags |= AV_FRAME_FLAG_KEY;

View File

@ -392,7 +392,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
pal = (uint32_t*)smk->pic->data[1];
bytestream2_init(&gb2, avpkt->data, avpkt->size);
flags = bytestream2_get_byteu(&gb2);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
smk->pic->palette_has_changed = flags & 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (flags & 2) {
smk->pic->flags |= AV_FRAME_FLAG_KEY;
smk->pic->pict_type = AV_PICTURE_TYPE_I;

View File

@ -437,7 +437,14 @@ static int smc_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed =
#endif
ff_copy_palette(s->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_ENABLE_DEPRECATION_WARNINGS
#endif
bytestream2_init(&gb, buf, buf_size);
ret = smc_decode_stream(s, &gb);

View File

@ -249,7 +249,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
}
break;
}
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
p->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
}

View File

@ -182,7 +182,11 @@ static int seqvideo_decode(SeqVideoContext *seq, const unsigned char *data, int
c[j] = (*data << 2) | (*data >> 4);
palette[i] = 0xFFU << 24 | AV_RB24(c);
}
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
seq->frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
if (flags & 2) {

View File

@ -60,7 +60,11 @@ static int tmv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
frame->flags |= AV_FRAME_FLAG_KEY;
dst = frame->data[0];
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
memcpy(frame->data[1], ff_cga_palette, 16 * 4);
memset(frame->data[1] + 16 * 4, 0, AVPALETTE_SIZE - 16 * 4);

View File

@ -106,7 +106,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
/* make the palette available on the way out */
if (c->avctx->pix_fmt == AV_PIX_FMT_PAL8) {
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = palette_has_changed;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
memcpy(frame->data[1], c->pal, AVPALETTE_SIZE);
}

View File

@ -230,7 +230,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
memcpy(frame->data[1], c->pal, AVPALETTE_SIZE);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = flags & VB_HAS_PALETTE;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
outptr = frame->data[0];
srcptr = c->frame;

View File

@ -809,7 +809,11 @@ static int vqa_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
/* make the palette available on the way out */
memcpy(s->frame->data[1], s->palette, PALETTE_COUNT * 4);
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
} else if (avctx->pix_fmt == AV_PIX_FMT_RGB555LE) {
if ((res = vqa_decode_frame_hicolor(s, s->frame)) < 0)
return res;

View File

@ -232,7 +232,11 @@ static int yop_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
(palette[i + firstcolor] >> 6) & 0x30303;
}
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
for (y = 0; y < avctx->height; y += 2) {
for (x = 0; x < avctx->width; x += 2) {

View File

@ -284,7 +284,11 @@ FF_DISABLE_DEPRECATION_WARNINGS
dst->top_field_first = src->top_field_first;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
#if FF_API_PALETTE_HAS_CHANGED
FF_DISABLE_DEPRECATION_WARNINGS
dst->palette_has_changed = src->palette_has_changed;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
dst->sample_rate = src->sample_rate;
dst->opaque = src->opaque;
dst->pkt_dts = src->pkt_dts;

View File

@ -528,10 +528,13 @@ typedef struct AVFrame {
int top_field_first;
#endif
#if FF_API_PALETTE_HAS_CHANGED
/**
* Tell user application that palette has changed from previous frame.
*/
attribute_deprecated
int palette_has_changed;
#endif
#if FF_API_REORDERED_OPAQUE
/**

View File

@ -117,6 +117,7 @@
#define FF_API_FRAME_PKT (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_INTERLACED_FRAME (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_FRAME_KEY (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_PALETTE_HAS_CHANGED (LIBAVUTIL_VERSION_MAJOR < 59)
/**
* @}