]> git.sesse.net Git - ffmpeg/commitdiff
avutil/pixdesc: Remove deprecated AV_PIX_FMT_FLAG_PSEUDOPAL
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Tue, 13 Apr 2021 23:46:26 +0000 (01:46 +0200)
committerJames Almer <jamrial@gmail.com>
Tue, 27 Apr 2021 13:43:13 +0000 (10:43 -0300)
Deprecated in d6fc031caf64eed921bbdef86d79d56bfc2633b0.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
16 files changed:
libavcodec/decode.c
libavcodec/ffv1dec.c
libavcodec/rawdec.c
libavfilter/drawutils.c
libavfilter/framepool.c
libavfilter/vf_crop.c
libavfilter/vf_pixdesctest.c
libavfilter/vf_scale.c
libavfilter/vf_untile.c
libavutil/frame.c
libavutil/imgutils.c
libavutil/internal.h
libavutil/pixdesc.c
libavutil/pixdesc.h
libavutil/version.h
tests/ref/fate/imgutils

index 1a7c37043eee570e0f71501a2538036d78966732..9e5230ae1d32625497f082e5c7784b83ea6aed10 100644 (file)
@@ -1425,8 +1425,7 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
         pic->data[i] = NULL;
         pic->linesize[i] = 0;
     }
-    if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
-        ((desc->flags & FF_PSEUDOPAL) && pic->data[1]))
+    if (desc->flags & AV_PIX_FMT_FLAG_PAL)
         avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format);
 
     if (s->debug & FF_DEBUG_BUFFERS)
@@ -1589,8 +1588,6 @@ static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame)
         int flags = desc ? desc->flags : 0;
         if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PAL))
             num_planes = 2;
-        if ((flags & FF_PSEUDOPAL) && frame->data[1])
-            num_planes = 2;
         for (i = 0; i < num_planes; i++) {
             av_assert0(frame->data[i]);
         }
index 8516fef5d74ad091077a30374cfc47a3cf4f5b92..14879779fa168fce49452907ac794618c9d15d3f 100644 (file)
@@ -952,8 +952,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
                          (fs->slice_y >> sv) + ((fs->slice_x >> sh) << pixshift);
 
             }
-            if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
-                desc->flags & FF_PSEUDOPAL) {
+            if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
                 dst[1] = p->data[1];
                 src[1] = f->last_picture.f->data[1];
             }
index d3756328baba6fe9010b6714507fea40aa5af318..a13f88b148aff4c2f84ae6ee0250c087056001db 100644 (file)
@@ -93,19 +93,13 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
         return AVERROR(EINVAL);
     }
 
-    if (desc->flags & (AV_PIX_FMT_FLAG_PAL | FF_PSEUDOPAL)) {
+    if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
         context->palette = av_buffer_alloc(AVPALETTE_SIZE);
         if (!context->palette)
             return AVERROR(ENOMEM);
-#if FF_API_PSEUDOPAL
-        if (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
-            avpriv_set_systematic_pal2((uint32_t*)context->palette->data, avctx->pix_fmt);
-#endif
-        else {
-            memset(context->palette->data, 0, AVPALETTE_SIZE);
-            if (avctx->bits_per_coded_sample == 1)
-                memset(context->palette->data, 0xff, 4);
-        }
+        memset(context->palette->data, 0, AVPALETTE_SIZE);
+        if (avctx->bits_per_coded_sample == 1)
+            memset(context->palette->data, 0xff, 4);
     }
 
     if ((avctx->extradata_size >= 9 &&
@@ -416,8 +410,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
         frame->linesize[1] = FFALIGN(frame->linesize[1], linesize_align);
     }
 
-    if ((avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) ||
-        (desc->flags & FF_PSEUDOPAL)) {
+    if (avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) {
         frame->buf[1]  = av_buffer_ref(context->palette);
         if (!frame->buf[1]) {
             av_buffer_unref(&frame->buf[0]);
index 0a59ff998735e1ee508a47fbd5525d3857b56985..f95e12091b3bec8ec185501b8d6c72b7da2674fb 100644 (file)
@@ -91,7 +91,7 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
 
     if (!desc || !desc->name)
         return AVERROR(EINVAL);
-    if (desc->flags & ~(AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL | AV_PIX_FMT_FLAG_ALPHA))
+    if (desc->flags & ~(AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA))
         return AVERROR(ENOSYS);
     if (format == AV_PIX_FMT_P010LE || format == AV_PIX_FMT_P010BE || format == AV_PIX_FMT_P016LE || format == AV_PIX_FMT_P016BE)
         return AVERROR(ENOSYS);
index dab8891524b2d31d41632883c83796a6b893367a..5f67fa170a8e7b2aec3fe61361b0680bee5e79cf 100644 (file)
@@ -102,8 +102,7 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t size),
             goto fail;
     }
 
-    if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
-        desc->flags & FF_PSEUDOPAL) {
+    if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
         pool->pools[1] = av_buffer_pool_init(AVPALETTE_SIZE, alloc);
         if (!pool->pools[1])
             goto fail;
@@ -226,8 +225,7 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool)
             frame->data[i] = frame->buf[i]->data;
         }
 
-        if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
-            desc->flags & FF_PSEUDOPAL) {
+        if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
             enum AVPixelFormat format =
                 pool->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : pool->format;
 
index 3d5cb95f786e6f41368b541e6216b5d36b713f3f..dffb6dab5e6822a05e6d7f06f86adc7316abf589 100644 (file)
@@ -300,7 +300,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
         frame->data[0] += s->y * frame->linesize[0];
         frame->data[0] += s->x * s->max_step[0];
 
-        if (!(desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & FF_PSEUDOPAL)) {
+        if (!(desc->flags & AV_PIX_FMT_FLAG_PAL)) {
             for (i = 1; i < 3; i ++) {
                 if (frame->data[i]) {
                     frame->data[i] += (s->y >> s->vsub) * frame->linesize[i];
index 680d1a772ab37b24b0751c1243261f60e85d0db5..066b8a0290659083d9f516af7832cb444482b3a6 100644 (file)
@@ -80,8 +80,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     }
 
     /* copy palette */
-    if (priv->pix_desc->flags & AV_PIX_FMT_FLAG_PAL ||
-        ((priv->pix_desc->flags & FF_PSEUDOPAL) && out->data[1] && in->data[1]))
+    if (priv->pix_desc->flags & AV_PIX_FMT_FLAG_PAL)
         memcpy(out->data[1], in->data[1], AVPALETTE_SIZE);
 
     for (c = 0; c < priv->pix_desc->nb_components; c++) {
index 5ad9334d02cbb5685fe43a7cd32a173502941701..3add31bace47572856800c9e2be2e317e958eeeb 100644 (file)
@@ -510,8 +510,7 @@ static int config_props(AVFilterLink *outlink)
 
     scale->input_is_pal = desc->flags & AV_PIX_FMT_FLAG_PAL;
     if (outfmt == AV_PIX_FMT_PAL8) outfmt = AV_PIX_FMT_BGR8;
-    scale->output_is_pal = av_pix_fmt_desc_get(outfmt)->flags & AV_PIX_FMT_FLAG_PAL ||
-                           av_pix_fmt_desc_get(outfmt)->flags & FF_PSEUDOPAL;
+    scale->output_is_pal = av_pix_fmt_desc_get(outfmt)->flags & AV_PIX_FMT_FLAG_PAL;
 
     if (scale->sws)
         sws_freeContext(scale->sws);
index 9a2eb2490101eaddeee1d4d8643f3c29f8d0db8f..154b92d08c433144cff1867503ee4e44cfed5f76 100644 (file)
@@ -136,7 +136,7 @@ static int activate(AVFilterContext *ctx)
         out->height = outlink->h;
         out->data[0] += y * out->linesize[0];
         out->data[0] += x * s->max_step[0];
-        if (!(s->desc->flags & AV_PIX_FMT_FLAG_PAL || s->desc->flags & FF_PSEUDOPAL)) {
+        if (!(s->desc->flags & AV_PIX_FMT_FLAG_PAL)) {
             for (i = 1; i < 3; i ++) {
                 if (out->data[i]) {
                     out->data[i] += (y >> s->desc->log2_chroma_w) * out->linesize[i];
index 7d5a36b2f1e086923937a0898c5bae8c14177c63..5bc8ab36df9e48f5a645b88fd98a8cd521f6aaa4 100644 (file)
@@ -741,7 +741,7 @@ static int calc_cropping_offsets(size_t offsets[4], const AVFrame *frame,
         int shift_x = (i == 1 || i == 2) ? desc->log2_chroma_w : 0;
         int shift_y = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
 
-        if (desc->flags & (AV_PIX_FMT_FLAG_PAL | FF_PSEUDOPAL) && i == 1) {
+        if (desc->flags & AV_PIX_FMT_FLAG_PAL && i == 1) {
             offsets[i] = 0;
             break;
         }
index bd1333170acea85e46cdb20f1fecaed8031468bb..53faad889a27d7a17e0b3194c1eb8f7fa8cc880b 100644 (file)
@@ -123,8 +123,7 @@ int av_image_fill_plane_sizes(size_t sizes[4], enum AVPixelFormat pix_fmt,
         return AVERROR(EINVAL);
     sizes[0] = linesizes[0] * (size_t)height;
 
-    if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
-        desc->flags & FF_PSEUDOPAL) {
+    if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
         sizes[1] = 256 * 4; /* palette is stored here as 256 32 bits words */
         return 0;
     }
@@ -250,7 +249,7 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
         av_free(buf);
         return ret;
     }
-    if (desc->flags & AV_PIX_FMT_FLAG_PAL || (desc->flags & FF_PSEUDOPAL && pointers[1])) {
+    if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
         avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);
         if (align < 4) {
             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],
         }
     }
 
-    if ((desc->flags & AV_PIX_FMT_FLAG_PAL ||
-         desc->flags & FF_PSEUDOPAL) && pointers[1] &&
+    if (desc->flags & AV_PIX_FMT_FLAG_PAL && pointers[1] &&
         pointers[1] - pointers[0] > linesizes[0] * h) {
         /* zero-initialize the padding before the palette */
         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],
     if (!desc || desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
         return;
 
-    if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
-        desc->flags & FF_PSEUDOPAL) {
+    if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
         copy_plane(dst_data[0], dst_linesizes[0],
                    src_data[0], src_linesizes[0],
                    width, height);
@@ -478,10 +475,6 @@ int av_image_get_buffer_size(enum AVPixelFormat pix_fmt,
     if (ret < 0)
         return ret;
 
-    // do not include palette for these pseudo-paletted formats
-    if (desc->flags & FF_PSEUDOPAL)
-        return FFALIGN(width, align) * height;
-
     ret = av_image_fill_linesizes(linesize, pix_fmt, width);
     if (ret < 0)
         return ret;
index 2ed1c2abb167fa8ad6d3f2157b41eefaf611d614..854e9cbed23087adade5ee1fad51bca82fb250e7 100644 (file)
@@ -292,15 +292,6 @@ void ff_check_pixfmt_descriptors(void);
  */
 int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);
 
-// Helper macro for AV_PIX_FMT_FLAG_PSEUDOPAL deprecation. Code inside FFmpeg
-// should always use FF_PSEUDOPAL. Once the public API flag gets removed, all
-// code using it is dead code.
-#if FF_API_PSEUDOPAL
-#define FF_PSEUDOPAL AV_PIX_FMT_FLAG_PSEUDOPAL
-#else
-#define FF_PSEUDOPAL 0
-#endif
-
 // Temporary typedef to simplify porting all AVBufferRef users to size_t
 #if FF_API_BUFFER_SIZE_T
 typedef int buffer_size_t;
index e701005bc08b15d040a278df5ab482b70a35a571..751843e99158686473e25979e404564077f387f2 100644 (file)
@@ -341,7 +341,6 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         .comp = {
             { 0, 1, 0, 0, 8 },        /* Y */
         },
-        .flags = FF_PSEUDOPAL,
         .alias = "gray8,y8",
     },
     [AV_PIX_FMT_MONOWHITE] = {
@@ -446,7 +445,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 1, 0, 3, 3 },        /* G */
             { 0, 1, 0, 6, 2 },        /* B */
         },
-        .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
+        .flags = AV_PIX_FMT_FLAG_RGB,
     },
     [AV_PIX_FMT_BGR4] = {
         .name = "bgr4",
@@ -470,7 +469,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 1, 0, 1, 2 },        /* G */
             { 0, 1, 0, 3, 1 },        /* B */
         },
-        .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
+        .flags = AV_PIX_FMT_FLAG_RGB,
     },
     [AV_PIX_FMT_RGB8] = {
         .name = "rgb8",
@@ -482,7 +481,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 1, 0, 3, 3 },        /* G */
             { 0, 1, 0, 0, 3 },        /* B */
         },
-        .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
+        .flags = AV_PIX_FMT_FLAG_RGB,
     },
     [AV_PIX_FMT_RGB4] = {
         .name = "rgb4",
@@ -506,7 +505,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 1, 0, 1, 2 },        /* G */
             { 0, 1, 0, 0, 1 },        /* B */
         },
-        .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
+        .flags = AV_PIX_FMT_FLAG_RGB,
     },
     [AV_PIX_FMT_NV12] = {
         .name = "nv12",
index 81b51b767f8fa5c2108fb233a720473b141ebdc9..9e7cfad9837ad12a48745d365501338f40ecfb82 100644 (file)
@@ -136,26 +136,6 @@ typedef struct AVPixFmtDescriptor {
  */
 #define AV_PIX_FMT_FLAG_RGB          (1 << 5)
 
-#if FF_API_PSEUDOPAL
-/**
- * The pixel format is "pseudo-paletted". This means that it contains a
- * fixed palette in the 2nd plane but the palette is fixed/constant for each
- * PIX_FMT. This allows interpreting the data as if it was PAL8, which can
- * in some cases be simpler. Or the data can be interpreted purely based on
- * the pixel format without using the palette.
- * An example of a pseudo-paletted format is AV_PIX_FMT_GRAY8
- *
- * @deprecated This flag is deprecated, and will be removed. When it is removed,
- * the extra palette allocation in AVFrame.data[1] is removed as well. Only
- * actual paletted formats (as indicated by AV_PIX_FMT_FLAG_PAL) will have a
- * palette. Starting with FFmpeg versions which have this flag deprecated, the
- * extra "pseudo" palette is already ignored, and API users are not required to
- * allocate a palette for AV_PIX_FMT_FLAG_PSEUDOPAL formats (it was required
- * before the deprecation, though).
- */
-#define AV_PIX_FMT_FLAG_PSEUDOPAL    (1 << 6)
-#endif
-
 /**
  * The pixel format has an alpha channel. This is set on all formats that
  * support alpha in some way, including AV_PIX_FMT_PAL8. The alpha is always
index 47cec351f0f86d6a834152fdb95483b62f62fc36..b78ff1acec00bbf94c4604c870df9c93f2b241c7 100644 (file)
  * @{
  */
 
-#ifndef FF_API_PSEUDOPAL
-#define FF_API_PSEUDOPAL                (LIBAVUTIL_VERSION_MAJOR < 57)
-#endif
 #ifndef FF_API_CHILD_CLASS_NEXT
 #define FF_API_CHILD_CLASS_NEXT         (LIBAVUTIL_VERSION_MAJOR < 57)
 #endif
index c968ea0e853555b7ad3f88b0d4aad80ec52f4c49..f510150ea16e9b4f149d1697300034f110fec394 100644 (file)
@@ -62,7 +62,7 @@ yuv422p         planes: 3, linesizes:  64  32  32   0, plane_sizes:  3072  1536
 yuv444p         planes: 3, linesizes:  64  64  64   0, plane_sizes:  3072  3072  3072     0, plane_offsets:  3072  3072     0, total_size: 9216
 yuv410p         planes: 3, linesizes:  64  16  16   0, plane_sizes:  3072   192   192     0, plane_offsets:  3072   192     0, total_size: 3456
 yuv411p         planes: 3, linesizes:  64  16  16   0, plane_sizes:  3072   768   768     0, plane_offsets:  3072   768     0, total_size: 4608
-gray            planes: 2, linesizes:  64   0   0   0, plane_sizes:  3072  1024     0     0, plane_offsets:  3072     0     0, total_size: 4096
+gray            planes: 1, linesizes:  64   0   0   0, plane_sizes:  3072     0     0     0, plane_offsets:     0     0     0, total_size: 3072
 monow           planes: 1, linesizes:   8   0   0   0, plane_sizes:   384     0     0     0, plane_offsets:     0     0     0, total_size: 384
 monob           planes: 1, linesizes:   8   0   0   0, plane_sizes:   384     0     0     0, plane_offsets:     0     0     0, total_size: 384
 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
 yuvj444p        planes: 3, linesizes:  64  64  64   0, plane_sizes:  3072  3072  3072     0, plane_offsets:  3072  3072     0, total_size: 9216
 uyvy422         planes: 1, linesizes: 128   0   0   0, plane_sizes:  6144     0     0     0, plane_offsets:     0     0     0, total_size: 6144
 uyyvyy411       planes: 1, linesizes:  96   0   0   0, plane_sizes:  4608     0     0     0, plane_offsets:     0     0     0, total_size: 4608
-bgr8            planes: 2, linesizes:  64   0   0   0, plane_sizes:  3072  1024     0     0, plane_offsets:  3072     0     0, total_size: 4096
+bgr8            planes: 1, linesizes:  64   0   0   0, plane_sizes:  3072     0     0     0, plane_offsets:     0     0     0, total_size: 3072
 bgr4            planes: 1, linesizes:  32   0   0   0, plane_sizes:  1536     0     0     0, plane_offsets:     0     0     0, total_size: 1536
-bgr4_byte       planes: 2, linesizes:  64   0   0   0, plane_sizes:  3072  1024     0     0, plane_offsets:  3072     0     0, total_size: 4096
-rgb8            planes: 2, linesizes:  64   0   0   0, plane_sizes:  3072  1024     0     0, plane_offsets:  3072     0     0, total_size: 4096
+bgr4_byte       planes: 1, linesizes:  64   0   0   0, plane_sizes:  3072     0     0     0, plane_offsets:     0     0     0, total_size: 3072
+rgb8            planes: 1, linesizes:  64   0   0   0, plane_sizes:  3072     0     0     0, plane_offsets:     0     0     0, total_size: 3072
 rgb4            planes: 1, linesizes:  32   0   0   0, plane_sizes:  1536     0     0     0, plane_offsets:     0     0     0, total_size: 1536
-rgb4_byte       planes: 2, linesizes:  64   0   0   0, plane_sizes:  3072  1024     0     0, plane_offsets:  3072     0     0, total_size: 4096
+rgb4_byte       planes: 1, linesizes:  64   0   0   0, plane_sizes:  3072     0     0     0, plane_offsets:     0     0     0, total_size: 3072
 nv12            planes: 2, linesizes:  64  64   0   0, plane_sizes:  3072  1536     0     0, plane_offsets:  3072     0     0, total_size: 4608
 nv21            planes: 2, linesizes:  64  64   0   0, plane_sizes:  3072  1536     0     0, plane_offsets:  3072     0     0, total_size: 4608
 argb            planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0     0     0, plane_offsets:     0     0     0, total_size: 12288