avutil/pixdesc: Remove deprecated AV_PIX_FMT_FLAG_PSEUDOPAL
Deprecated in d6fc031caf
.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
1eb3110115
commit
985c0dac67
|
@ -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]);
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -105,9 +105,6 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue