Skip to content

Commit 985c0da

Browse files
mkverjamrial
authored andcommitted
avutil/pixdesc: Remove deprecated AV_PIX_FMT_FLAG_PSEUDOPAL
Deprecated in d6fc031. Signed-off-by: Andreas Rheinhardt <[email protected]> Signed-off-by: James Almer <[email protected]>
1 parent 1eb3110 commit 985c0da

File tree

16 files changed

+28
-83
lines changed

16 files changed

+28
-83
lines changed

libavcodec/decode.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,8 +1425,7 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
14251425
pic->data[i] = NULL;
14261426
pic->linesize[i] = 0;
14271427
}
1428-
if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
1429-
((desc->flags & FF_PSEUDOPAL) && pic->data[1]))
1428+
if (desc->flags & AV_PIX_FMT_FLAG_PAL)
14301429
avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format);
14311430

14321431
if (s->debug & FF_DEBUG_BUFFERS)
@@ -1589,8 +1588,6 @@ static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame)
15891588
int flags = desc ? desc->flags : 0;
15901589
if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PAL))
15911590
num_planes = 2;
1592-
if ((flags & FF_PSEUDOPAL) && frame->data[1])
1593-
num_planes = 2;
15941591
for (i = 0; i < num_planes; i++) {
15951592
av_assert0(frame->data[i]);
15961593
}

libavcodec/ffv1dec.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -952,8 +952,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
952952
(fs->slice_y >> sv) + ((fs->slice_x >> sh) << pixshift);
953953

954954
}
955-
if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
956-
desc->flags & FF_PSEUDOPAL) {
955+
if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
957956
dst[1] = p->data[1];
958957
src[1] = f->last_picture.f->data[1];
959958
}

libavcodec/rawdec.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,13 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
9393
return AVERROR(EINVAL);
9494
}
9595

96-
if (desc->flags & (AV_PIX_FMT_FLAG_PAL | FF_PSEUDOPAL)) {
96+
if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
9797
context->palette = av_buffer_alloc(AVPALETTE_SIZE);
9898
if (!context->palette)
9999
return AVERROR(ENOMEM);
100-
#if FF_API_PSEUDOPAL
101-
if (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
102-
avpriv_set_systematic_pal2((uint32_t*)context->palette->data, avctx->pix_fmt);
103-
#endif
104-
else {
105-
memset(context->palette->data, 0, AVPALETTE_SIZE);
106-
if (avctx->bits_per_coded_sample == 1)
107-
memset(context->palette->data, 0xff, 4);
108-
}
100+
memset(context->palette->data, 0, AVPALETTE_SIZE);
101+
if (avctx->bits_per_coded_sample == 1)
102+
memset(context->palette->data, 0xff, 4);
109103
}
110104

111105
if ((avctx->extradata_size >= 9 &&
@@ -416,8 +410,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
416410
frame->linesize[1] = FFALIGN(frame->linesize[1], linesize_align);
417411
}
418412

419-
if ((avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) ||
420-
(desc->flags & FF_PSEUDOPAL)) {
413+
if (avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) {
421414
frame->buf[1] = av_buffer_ref(context->palette);
422415
if (!frame->buf[1]) {
423416
av_buffer_unref(&frame->buf[0]);

libavfilter/drawutils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
9191

9292
if (!desc || !desc->name)
9393
return AVERROR(EINVAL);
94-
if (desc->flags & ~(AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL | AV_PIX_FMT_FLAG_ALPHA))
94+
if (desc->flags & ~(AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA))
9595
return AVERROR(ENOSYS);
9696
if (format == AV_PIX_FMT_P010LE || format == AV_PIX_FMT_P010BE || format == AV_PIX_FMT_P016LE || format == AV_PIX_FMT_P016BE)
9797
return AVERROR(ENOSYS);

libavfilter/framepool.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t size),
102102
goto fail;
103103
}
104104

105-
if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
106-
desc->flags & FF_PSEUDOPAL) {
105+
if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
107106
pool->pools[1] = av_buffer_pool_init(AVPALETTE_SIZE, alloc);
108107
if (!pool->pools[1])
109108
goto fail;
@@ -226,8 +225,7 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool)
226225
frame->data[i] = frame->buf[i]->data;
227226
}
228227

229-
if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
230-
desc->flags & FF_PSEUDOPAL) {
228+
if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
231229
enum AVPixelFormat format =
232230
pool->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : pool->format;
233231

libavfilter/vf_crop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
300300
frame->data[0] += s->y * frame->linesize[0];
301301
frame->data[0] += s->x * s->max_step[0];
302302

303-
if (!(desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & FF_PSEUDOPAL)) {
303+
if (!(desc->flags & AV_PIX_FMT_FLAG_PAL)) {
304304
for (i = 1; i < 3; i ++) {
305305
if (frame->data[i]) {
306306
frame->data[i] += (s->y >> s->vsub) * frame->linesize[i];

libavfilter/vf_pixdesctest.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
8080
}
8181

8282
/* copy palette */
83-
if (priv->pix_desc->flags & AV_PIX_FMT_FLAG_PAL ||
84-
((priv->pix_desc->flags & FF_PSEUDOPAL) && out->data[1] && in->data[1]))
83+
if (priv->pix_desc->flags & AV_PIX_FMT_FLAG_PAL)
8584
memcpy(out->data[1], in->data[1], AVPALETTE_SIZE);
8685

8786
for (c = 0; c < priv->pix_desc->nb_components; c++) {

libavfilter/vf_scale.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,7 @@ static int config_props(AVFilterLink *outlink)
510510

511511
scale->input_is_pal = desc->flags & AV_PIX_FMT_FLAG_PAL;
512512
if (outfmt == AV_PIX_FMT_PAL8) outfmt = AV_PIX_FMT_BGR8;
513-
scale->output_is_pal = av_pix_fmt_desc_get(outfmt)->flags & AV_PIX_FMT_FLAG_PAL ||
514-
av_pix_fmt_desc_get(outfmt)->flags & FF_PSEUDOPAL;
513+
scale->output_is_pal = av_pix_fmt_desc_get(outfmt)->flags & AV_PIX_FMT_FLAG_PAL;
515514

516515
if (scale->sws)
517516
sws_freeContext(scale->sws);

libavfilter/vf_untile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static int activate(AVFilterContext *ctx)
136136
out->height = outlink->h;
137137
out->data[0] += y * out->linesize[0];
138138
out->data[0] += x * s->max_step[0];
139-
if (!(s->desc->flags & AV_PIX_FMT_FLAG_PAL || s->desc->flags & FF_PSEUDOPAL)) {
139+
if (!(s->desc->flags & AV_PIX_FMT_FLAG_PAL)) {
140140
for (i = 1; i < 3; i ++) {
141141
if (out->data[i]) {
142142
out->data[i] += (y >> s->desc->log2_chroma_w) * out->linesize[i];

libavutil/frame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ static int calc_cropping_offsets(size_t offsets[4], const AVFrame *frame,
741741
int shift_x = (i == 1 || i == 2) ? desc->log2_chroma_w : 0;
742742
int shift_y = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
743743

744-
if (desc->flags & (AV_PIX_FMT_FLAG_PAL | FF_PSEUDOPAL) && i == 1) {
744+
if (desc->flags & AV_PIX_FMT_FLAG_PAL && i == 1) {
745745
offsets[i] = 0;
746746
break;
747747
}

libavutil/imgutils.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ int av_image_fill_plane_sizes(size_t sizes[4], enum AVPixelFormat pix_fmt,
123123
return AVERROR(EINVAL);
124124
sizes[0] = linesizes[0] * (size_t)height;
125125

126-
if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
127-
desc->flags & FF_PSEUDOPAL) {
126+
if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
128127
sizes[1] = 256 * 4; /* palette is stored here as 256 32 bits words */
129128
return 0;
130129
}
@@ -250,7 +249,7 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
250249
av_free(buf);
251250
return ret;
252251
}
253-
if (desc->flags & AV_PIX_FMT_FLAG_PAL || (desc->flags & FF_PSEUDOPAL && pointers[1])) {
252+
if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
254253
avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);
255254
if (align < 4) {
256255
av_log(NULL, AV_LOG_ERROR, "Formats with a palette require a minimum alignment of 4\n");
@@ -259,8 +258,7 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
259258
}
260259
}
261260

262-
if ((desc->flags & AV_PIX_FMT_FLAG_PAL ||
263-
desc->flags & FF_PSEUDOPAL) && pointers[1] &&
261+
if (desc->flags & AV_PIX_FMT_FLAG_PAL && pointers[1] &&
264262
pointers[1] - pointers[0] > linesizes[0] * h) {
265263
/* zero-initialize the padding before the palette */
266264
memset(pointers[0] + linesizes[0] * h, 0,
@@ -388,8 +386,7 @@ static void image_copy(uint8_t *dst_data[4], const ptrdiff_t dst_linesizes[4],
388386
if (!desc || desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
389387
return;
390388

391-
if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
392-
desc->flags & FF_PSEUDOPAL) {
389+
if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
393390
copy_plane(dst_data[0], dst_linesizes[0],
394391
src_data[0], src_linesizes[0],
395392
width, height);
@@ -478,10 +475,6 @@ int av_image_get_buffer_size(enum AVPixelFormat pix_fmt,
478475
if (ret < 0)
479476
return ret;
480477

481-
// do not include palette for these pseudo-paletted formats
482-
if (desc->flags & FF_PSEUDOPAL)
483-
return FFALIGN(width, align) * height;
484-
485478
ret = av_image_fill_linesizes(linesize, pix_fmt, width);
486479
if (ret < 0)
487480
return ret;

libavutil/internal.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,6 @@ void ff_check_pixfmt_descriptors(void);
292292
*/
293293
int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);
294294

295-
// Helper macro for AV_PIX_FMT_FLAG_PSEUDOPAL deprecation. Code inside FFmpeg
296-
// should always use FF_PSEUDOPAL. Once the public API flag gets removed, all
297-
// code using it is dead code.
298-
#if FF_API_PSEUDOPAL
299-
#define FF_PSEUDOPAL AV_PIX_FMT_FLAG_PSEUDOPAL
300-
#else
301-
#define FF_PSEUDOPAL 0
302-
#endif
303-
304295
// Temporary typedef to simplify porting all AVBufferRef users to size_t
305296
#if FF_API_BUFFER_SIZE_T
306297
typedef int buffer_size_t;

libavutil/pixdesc.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,6 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
341341
.comp = {
342342
{ 0, 1, 0, 0, 8 }, /* Y */
343343
},
344-
.flags = FF_PSEUDOPAL,
345344
.alias = "gray8,y8",
346345
},
347346
[AV_PIX_FMT_MONOWHITE] = {
@@ -446,7 +445,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
446445
{ 0, 1, 0, 3, 3 }, /* G */
447446
{ 0, 1, 0, 6, 2 }, /* B */
448447
},
449-
.flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
448+
.flags = AV_PIX_FMT_FLAG_RGB,
450449
},
451450
[AV_PIX_FMT_BGR4] = {
452451
.name = "bgr4",
@@ -470,7 +469,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
470469
{ 0, 1, 0, 1, 2 }, /* G */
471470
{ 0, 1, 0, 3, 1 }, /* B */
472471
},
473-
.flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
472+
.flags = AV_PIX_FMT_FLAG_RGB,
474473
},
475474
[AV_PIX_FMT_RGB8] = {
476475
.name = "rgb8",
@@ -482,7 +481,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
482481
{ 0, 1, 0, 3, 3 }, /* G */
483482
{ 0, 1, 0, 0, 3 }, /* B */
484483
},
485-
.flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
484+
.flags = AV_PIX_FMT_FLAG_RGB,
486485
},
487486
[AV_PIX_FMT_RGB4] = {
488487
.name = "rgb4",
@@ -506,7 +505,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
506505
{ 0, 1, 0, 1, 2 }, /* G */
507506
{ 0, 1, 0, 0, 1 }, /* B */
508507
},
509-
.flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
508+
.flags = AV_PIX_FMT_FLAG_RGB,
510509
},
511510
[AV_PIX_FMT_NV12] = {
512511
.name = "nv12",

libavutil/pixdesc.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -136,26 +136,6 @@ typedef struct AVPixFmtDescriptor {
136136
*/
137137
#define AV_PIX_FMT_FLAG_RGB (1 << 5)
138138

139-
#if FF_API_PSEUDOPAL
140-
/**
141-
* The pixel format is "pseudo-paletted". This means that it contains a
142-
* fixed palette in the 2nd plane but the palette is fixed/constant for each
143-
* PIX_FMT. This allows interpreting the data as if it was PAL8, which can
144-
* in some cases be simpler. Or the data can be interpreted purely based on
145-
* the pixel format without using the palette.
146-
* An example of a pseudo-paletted format is AV_PIX_FMT_GRAY8
147-
*
148-
* @deprecated This flag is deprecated, and will be removed. When it is removed,
149-
* the extra palette allocation in AVFrame.data[1] is removed as well. Only
150-
* actual paletted formats (as indicated by AV_PIX_FMT_FLAG_PAL) will have a
151-
* palette. Starting with FFmpeg versions which have this flag deprecated, the
152-
* extra "pseudo" palette is already ignored, and API users are not required to
153-
* allocate a palette for AV_PIX_FMT_FLAG_PSEUDOPAL formats (it was required
154-
* before the deprecation, though).
155-
*/
156-
#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6)
157-
#endif
158-
159139
/**
160140
* The pixel format has an alpha channel. This is set on all formats that
161141
* support alpha in some way, including AV_PIX_FMT_PAL8. The alpha is always

libavutil/version.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@
105105
* @{
106106
*/
107107

108-
#ifndef FF_API_PSEUDOPAL
109-
#define FF_API_PSEUDOPAL (LIBAVUTIL_VERSION_MAJOR < 57)
110-
#endif
111108
#ifndef FF_API_CHILD_CLASS_NEXT
112109
#define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57)
113110
#endif

tests/ref/fate/imgutils

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ yuv422p planes: 3, linesizes: 64 32 32 0, plane_sizes: 3072 1536
6262
yuv444p planes: 3, linesizes: 64 64 64 0, plane_sizes: 3072 3072 3072 0, plane_offsets: 3072 3072 0, total_size: 9216
6363
yuv410p planes: 3, linesizes: 64 16 16 0, plane_sizes: 3072 192 192 0, plane_offsets: 3072 192 0, total_size: 3456
6464
yuv411p planes: 3, linesizes: 64 16 16 0, plane_sizes: 3072 768 768 0, plane_offsets: 3072 768 0, total_size: 4608
65-
gray planes: 2, linesizes: 64 0 0 0, plane_sizes: 3072 1024 0 0, plane_offsets: 3072 0 0, total_size: 4096
65+
gray planes: 1, linesizes: 64 0 0 0, plane_sizes: 3072 0 0 0, plane_offsets: 0 0 0, total_size: 3072
6666
monow planes: 1, linesizes: 8 0 0 0, plane_sizes: 384 0 0 0, plane_offsets: 0 0 0, total_size: 384
6767
monob planes: 1, linesizes: 8 0 0 0, plane_sizes: 384 0 0 0, plane_offsets: 0 0 0, total_size: 384
6868
pal8 planes: 2, linesizes: 64 0 0 0, plane_sizes: 3072 1024 0 0, plane_offsets: 3072 0 0, total_size: 4096
@@ -71,12 +71,12 @@ yuvj422p planes: 3, linesizes: 64 32 32 0, plane_sizes: 3072 1536
7171
yuvj444p planes: 3, linesizes: 64 64 64 0, plane_sizes: 3072 3072 3072 0, plane_offsets: 3072 3072 0, total_size: 9216
7272
uyvy422 planes: 1, linesizes: 128 0 0 0, plane_sizes: 6144 0 0 0, plane_offsets: 0 0 0, total_size: 6144
7373
uyyvyy411 planes: 1, linesizes: 96 0 0 0, plane_sizes: 4608 0 0 0, plane_offsets: 0 0 0, total_size: 4608
74-
bgr8 planes: 2, linesizes: 64 0 0 0, plane_sizes: 3072 1024 0 0, plane_offsets: 3072 0 0, total_size: 4096
74+
bgr8 planes: 1, linesizes: 64 0 0 0, plane_sizes: 3072 0 0 0, plane_offsets: 0 0 0, total_size: 3072
7575
bgr4 planes: 1, linesizes: 32 0 0 0, plane_sizes: 1536 0 0 0, plane_offsets: 0 0 0, total_size: 1536
76-
bgr4_byte planes: 2, linesizes: 64 0 0 0, plane_sizes: 3072 1024 0 0, plane_offsets: 3072 0 0, total_size: 4096
77-
rgb8 planes: 2, linesizes: 64 0 0 0, plane_sizes: 3072 1024 0 0, plane_offsets: 3072 0 0, total_size: 4096
76+
bgr4_byte planes: 1, linesizes: 64 0 0 0, plane_sizes: 3072 0 0 0, plane_offsets: 0 0 0, total_size: 3072
77+
rgb8 planes: 1, linesizes: 64 0 0 0, plane_sizes: 3072 0 0 0, plane_offsets: 0 0 0, total_size: 3072
7878
rgb4 planes: 1, linesizes: 32 0 0 0, plane_sizes: 1536 0 0 0, plane_offsets: 0 0 0, total_size: 1536
79-
rgb4_byte planes: 2, linesizes: 64 0 0 0, plane_sizes: 3072 1024 0 0, plane_offsets: 3072 0 0, total_size: 4096
79+
rgb4_byte planes: 1, linesizes: 64 0 0 0, plane_sizes: 3072 0 0 0, plane_offsets: 0 0 0, total_size: 3072
8080
nv12 planes: 2, linesizes: 64 64 0 0, plane_sizes: 3072 1536 0 0, plane_offsets: 3072 0 0, total_size: 4608
8181
nv21 planes: 2, linesizes: 64 64 0 0, plane_sizes: 3072 1536 0 0, plane_offsets: 3072 0 0, total_size: 4608
8282
argb planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288

0 commit comments

Comments
 (0)