History

avutil/pixdesc: deprecate AV_PIX_FMT_FLAG_PSEUDOPAL

PSEUDOPAL pixel formats are not paletted, but carried a palette with the intention of allowing code to treat unpaletted formats as paletted. The palette simply mapped the byte values to the resulting RGB values, making it some sort of LUT for RGB conversion. It was used for 1 byte formats only: RGB4_BYTE, BGR4_BYTE, RGB8, BGR8, GRAY8. The first 4 are awfully obscure, used only by some ancient bitmap formats. The last one, GRAY8, is more common, but its treatment is grossly incorrect. It considers full range GRAY8 only, so GRAY8 coming from typical Y video planes was not mapped to the correct RGB values. This cannot be fixed, because AVFrame.color_range can be freely changed at runtime, and there is nothing to ensure the pseudo palette is updated. Also, nothing actually used the PSEUDOPAL palette data, except xwdenc (trivially changed in the previous commit). All other code had to treat it as a special case, just to ignore or to propagate palette data. In conclusion, this was just a very strange old mechnaism that has no real justification to exist anymore (although it may have been nice and useful in the past). Now it's an artifact that makes the API harder to use: API users who allocate their own pixel data have to be aware that they need to allocate the palette, or FFmpeg will crash on them in _some_ situations. On top of this, there was no API to allocate the pseuo palette outside of av_frame_get_buffer(). This patch not only deprecates AV_PIX_FMT_FLAG_PSEUDOPAL, but also makes the pseudo palette optional. Nothing accesses it anymore, though if it's set, it's propagated. It's still allocated and initialized for compatibility with API users that rely on this feature. But new API users do not need to allocate it. This was an explicit goal of this patch. Most changes replace AV_PIX_FMT_FLAG_PSEUDOPAL with FF_PSEUDOPAL. I first tried #ifdefing all code, but it was a mess. The FF_PSEUDOPAL macro reduces the mess, and still allows defining FF_API_PSEUDOPAL to 0. Passes FATE with FF_API_PSEUDOPAL enabled and disabled. In addition, FATE passes with FF_API_PSEUDOPAL set to 1, but with allocation functions manually changed to not allocating a palette.

wm4 committed 8 years ago

Commit d6fc0311 parent e53d33419 files · +67 −34Browse files

Unified · Split

19 files
  1. doc/APIchanges +4 −0
  2. fftools/ffprobe.c +2 −0
  3. libavcodec/decode.c +1 −4
  4. libavcodec/ffv1dec.c +1 −1
  5. libavcodec/rawdec.c +4 −2
  6. libavcodec/smvjpegdec.c +1 −1
  7. libavfilter/drawutils.c +1 −1
  8. libavfilter/framepool.c +2 −2
  9. libavfilter/vf_crop.c +1 −1
  10. libavfilter/vf_pixdesctest.c +1 −1
  11. libavfilter/vf_scale.c +2 −3
  12. libavfilter/vf_shuffleplanes.c +1 −1
  13. libavutil/frame.c +2 −2
  14. libavutil/imgutils.c +7 −6
  15. libavutil/internal.h +9 −0
  16. libavutil/pixdesc.c +5 −5
  17. libavutil/pixdesc.h +8 −0
  18. libavutil/version.h +4 −1
  19. libswscale/swscale_internal.h +11 −3
doc/APIchanges+4−0
@@ -15,6 +15,10 @@ libavutil: 2017-10-21 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182018-04-03 - xxxxxxx - lavu 56.13.100 - pixdesc.h
19 Deprecate AV_PIX_FMT_FLAG_PSEUDOPAL and make allocating a pseudo palette
20 optional for API users (see AV_PIX_FMT_FLAG_PSEUDOPAL doxygen for details).
21
182018-04-01 - xxxxxxx - lavc 58.17.100 - avcodec.h222018-04-01 - xxxxxxx - lavc 58.17.100 - avcodec.h
19 Add av_packet_make_refcounted().23 Add av_packet_make_refcounted().
20 24
fftools/ffprobe.c+2−0
@@ -3118,7 +3118,9 @@ static void ffprobe_show_pixel_formats(WriterContext *w) · 3117 unmodified lines
3118 PRINT_PIX_FMT_FLAG(HWACCEL, "hwaccel");3118 PRINT_PIX_FMT_FLAG(HWACCEL, "hwaccel");
3119 PRINT_PIX_FMT_FLAG(PLANAR, "planar");3119 PRINT_PIX_FMT_FLAG(PLANAR, "planar");
3120 PRINT_PIX_FMT_FLAG(RGB, "rgb");3120 PRINT_PIX_FMT_FLAG(RGB, "rgb");
3121#if FF_API_PSEUDOPAL
3121 PRINT_PIX_FMT_FLAG(PSEUDOPAL, "pseudopal");3122 PRINT_PIX_FMT_FLAG(PSEUDOPAL, "pseudopal");
3123#endif
3122 PRINT_PIX_FMT_FLAG(ALPHA, "alpha");3124 PRINT_PIX_FMT_FLAG(ALPHA, "alpha");
3123 writer_print_section_footer(w);3125 writer_print_section_footer(w);
3124 }3126 }
libavcodec/decode.c+1−4
@@ -1614,7 +1614,7 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic) · 1613 unmodified lines
1614 pic->linesize[i] = 0;1614 pic->linesize[i] = 0;
1615 }1615 }
1616 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||1616 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
1617 desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)1617 ((desc->flags & FF_PSEUDOPAL) && pic->data[1]))
1618 avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format);1618 avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format);
1619 1619
1620 if (s->debug & FF_DEBUG_BUFFERS)1620 if (s->debug & FF_DEBUG_BUFFERS)
@@ -1782,9 +1782,6 @@ static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame) · 161 unmodified lines
1782 for (i = 0; i < num_planes; i++) {1782 for (i = 0; i < num_planes; i++) {
1783 av_assert0(frame->data[i]);1783 av_assert0(frame->data[i]);
1784 }1784 }
1785 // For now do not enforce anything for palette of pseudopal formats
1786 if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PSEUDOPAL))
1787 num_planes = 2;
1788 // For formats without data like hwaccel allow unused pointers to be non-NULL.1785 // For formats without data like hwaccel allow unused pointers to be non-NULL.
1789 for (i = num_planes; num_planes > 0 && i < FF_ARRAY_ELEMS(frame->data); i++) {1786 for (i = num_planes; num_planes > 0 && i < FF_ARRAY_ELEMS(frame->data); i++) {
1790 if (frame->data[i])1787 if (frame->data[i])
libavcodec/ffv1dec.c+1−1
@@ -950,7 +950,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac · 949 unmodified lines
950 950
951 }951 }
952 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||952 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
953 desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {953 desc->flags & FF_PSEUDOPAL) {
954 dst[1] = p->data[1];954 dst[1] = p->data[1];
955 src[1] = f->last_picture.f->data[1];955 src[1] = f->last_picture.f->data[1];
956 }956 }
libavcodec/rawdec.c+4−2
@@ -92,12 +92,14 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx) · 91 unmodified lines
92 return AVERROR(EINVAL);92 return AVERROR(EINVAL);
93 }93 }
94 94
95 if (desc->flags & (AV_PIX_FMT_FLAG_PAL | AV_PIX_FMT_FLAG_PSEUDOPAL)) {95 if (desc->flags & (AV_PIX_FMT_FLAG_PAL | FF_PSEUDOPAL)) {
96 context->palette = av_buffer_alloc(AVPALETTE_SIZE);96 context->palette = av_buffer_alloc(AVPALETTE_SIZE);
97 if (!context->palette)97 if (!context->palette)
98 return AVERROR(ENOMEM);98 return AVERROR(ENOMEM);
99#if FF_API_PSEUDOPAL
99 if (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)100 if (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
100 avpriv_set_systematic_pal2((uint32_t*)context->palette->data, avctx->pix_fmt);101 avpriv_set_systematic_pal2((uint32_t*)context->palette->data, avctx->pix_fmt);
102#endif
101 else {103 else {
102 memset(context->palette->data, 0, AVPALETTE_SIZE);104 memset(context->palette->data, 0, AVPALETTE_SIZE);
103 if (avctx->bits_per_coded_sample == 1)105 if (avctx->bits_per_coded_sample == 1)
@@ -423,7 +425,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, · 319 unmodified lines
423 }425 }
424 426
425 if ((avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) ||427 if ((avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) ||
426 (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)) {428 (desc->flags & FF_PSEUDOPAL)) {
427 frame->buf[1] = av_buffer_ref(context->palette);429 frame->buf[1] = av_buffer_ref(context->palette);
428 if (!frame->buf[1]) {430 if (!frame->buf[1]) {
429 av_buffer_unref(&frame->buf[0]);431 av_buffer_unref(&frame->buf[0]);
libavcodec/smvjpegdec.c+1−1
@@ -71,7 +71,7 @@ static inline void smv_img_pnt(uint8_t *dst_data[4], uint8_t *src_data[4], · 70 unmodified lines
71 src_linesizes[i], h, nlines);71 src_linesizes[i], h, nlines);
72 }72 }
73 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||73 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
74 desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)74 desc->flags & FF_PSEUDOPAL)
75 dst_data[1] = src_data[1];75 dst_data[1] = src_data[1];
76}76}
77 77
libavfilter/drawutils.c+1−1
@@ -184,7 +184,7 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags) · 183 unmodified lines
184 184
185 if (!desc || !desc->name)185 if (!desc || !desc->name)
186 return AVERROR(EINVAL);186 return AVERROR(EINVAL);
187 if (desc->flags & ~(AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL | AV_PIX_FMT_FLAG_ALPHA))187 if (desc->flags & ~(AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL | AV_PIX_FMT_FLAG_ALPHA))
188 return AVERROR(ENOSYS);188 return AVERROR(ENOSYS);
189 if (format == AV_PIX_FMT_P010LE || format == AV_PIX_FMT_P010BE || format == AV_PIX_FMT_P016LE || format == AV_PIX_FMT_P016BE)189 if (format == AV_PIX_FMT_P010LE || format == AV_PIX_FMT_P010BE || format == AV_PIX_FMT_P016LE || format == AV_PIX_FMT_P016BE)
190 return AVERROR(ENOSYS);190 return AVERROR(ENOSYS);
libavfilter/framepool.c+2−2
@@ -103,7 +103,7 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(int size), · 102 unmodified lines
103 }103 }
104 104
105 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||105 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
106 desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {106 desc->flags & FF_PSEUDOPAL) {
107 pool->pools[1] = av_buffer_pool_init(AVPALETTE_SIZE, alloc);107 pool->pools[1] = av_buffer_pool_init(AVPALETTE_SIZE, alloc);
108 if (!pool->pools[1])108 if (!pool->pools[1])
109 goto fail;109 goto fail;
@@ -227,7 +227,7 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool) · 117 unmodified lines
227 }227 }
228 228
229 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||229 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
230 desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {230 desc->flags & FF_PSEUDOPAL) {
231 enum AVPixelFormat format =231 enum AVPixelFormat format =
232 pool->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : pool->format;232 pool->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : pool->format;
233 233
libavfilter/vf_crop.c+1−1
@@ -288,7 +288,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) · 287 unmodified lines
288 frame->data[0] += s->y * frame->linesize[0];288 frame->data[0] += s->y * frame->linesize[0];
289 frame->data[0] += s->x * s->max_step[0];289 frame->data[0] += s->x * s->max_step[0];
290 290
291 if (!(desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)) {291 if (!(desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & FF_PSEUDOPAL)) {
292 for (i = 1; i < 3; i ++) {292 for (i = 1; i < 3; i ++) {
293 if (frame->data[i]) {293 if (frame->data[i]) {
294 frame->data[i] += (s->y >> s->vsub) * frame->linesize[i];294 frame->data[i] += (s->y >> s->vsub) * frame->linesize[i];
libavfilter/vf_pixdesctest.c+1−1
@@ -81,7 +81,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 80 unmodified lines
81 81
82 /* copy palette */82 /* copy palette */
83 if (priv->pix_desc->flags & AV_PIX_FMT_FLAG_PAL ||83 if (priv->pix_desc->flags & AV_PIX_FMT_FLAG_PAL ||
84 priv->pix_desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)84 ((priv->pix_desc->flags & FF_PSEUDOPAL) && out->data[1] && in->data[1]))
85 memcpy(out->data[1], in->data[1], AVPALETTE_SIZE);85 memcpy(out->data[1], in->data[1], AVPALETTE_SIZE);
86 86
87 for (c = 0; c < priv->pix_desc->nb_components; c++) {87 for (c = 0; c < priv->pix_desc->nb_components; c++) {
libavfilter/vf_scale.c+2−3
@@ -261,11 +261,10 @@ static int config_props(AVFilterLink *outlink) · 260 unmodified lines
261 261
262 /* TODO: make algorithm configurable */262 /* TODO: make algorithm configurable */
263 263
264 scale->input_is_pal = desc->flags & AV_PIX_FMT_FLAG_PAL ||264 scale->input_is_pal = desc->flags & AV_PIX_FMT_FLAG_PAL;
265 desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL;
266 if (outfmt == AV_PIX_FMT_PAL8) outfmt = AV_PIX_FMT_BGR8;265 if (outfmt == AV_PIX_FMT_PAL8) outfmt = AV_PIX_FMT_BGR8;
267 scale->output_is_pal = av_pix_fmt_desc_get(outfmt)->flags & AV_PIX_FMT_FLAG_PAL ||266 scale->output_is_pal = av_pix_fmt_desc_get(outfmt)->flags & AV_PIX_FMT_FLAG_PAL ||
268 av_pix_fmt_desc_get(outfmt)->flags & AV_PIX_FMT_FLAG_PSEUDOPAL;267 av_pix_fmt_desc_get(outfmt)->flags & FF_PSEUDOPAL;
269 268
270 if (scale->sws)269 if (scale->sws)
271 sws_freeContext(scale->sws);270 sws_freeContext(scale->sws);
libavfilter/vf_shuffleplanes.c+1−1
@@ -69,7 +69,7 @@ static av_cold int shuffleplanes_config_input(AVFilterLink *inlink) · 68 unmodified lines
69 }69 }
70 70
71 if ((desc->flags & AV_PIX_FMT_FLAG_PAL ||71 if ((desc->flags & AV_PIX_FMT_FLAG_PAL ||
72 desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) &&72 desc->flags & FF_PSEUDOPAL) &&
73 (i == 1) != (s->map[i] == 1)) {73 (i == 1) != (s->map[i] == 1)) {
74 av_log(ctx, AV_LOG_ERROR,74 av_log(ctx, AV_LOG_ERROR,
75 "Cannot map between a palette plane and a data plane.\n");75 "Cannot map between a palette plane and a data plane.\n");
libavutil/frame.c+2−2
@@ -247,7 +247,7 @@ static int get_video_buffer(AVFrame *frame, int align) · 246 unmodified lines
247 247
248 frame->data[i] = frame->buf[i]->data;248 frame->data[i] = frame->buf[i]->data;
249 }249 }
250 if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {250 if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & FF_PSEUDOPAL) {
251 av_buffer_unref(&frame->buf[1]);251 av_buffer_unref(&frame->buf[1]);
252 frame->buf[1] = av_buffer_alloc(AVPALETTE_SIZE);252 frame->buf[1] = av_buffer_alloc(AVPALETTE_SIZE);
253 if (!frame->buf[1])253 if (!frame->buf[1])
@@ -848,7 +848,7 @@ static int calc_cropping_offsets(size_t offsets[4], const AVFrame *frame, · 594 unmodified lines
848 int shift_x = (i == 1 || i == 2) ? desc->log2_chroma_w : 0;848 int shift_x = (i == 1 || i == 2) ? desc->log2_chroma_w : 0;
849 int shift_y = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;849 int shift_y = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
850 850
851 if (desc->flags & (AV_PIX_FMT_FLAG_PAL | AV_PIX_FMT_FLAG_PSEUDOPAL) && i == 1) {851 if (desc->flags & (AV_PIX_FMT_FLAG_PAL | FF_PSEUDOPAL) && i == 1) {
852 offsets[i] = 0;852 offsets[i] = 0;
853 break;853 break;
854 }854 }
libavutil/imgutils.c+7−6
@@ -125,7 +125,7 @@ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei · 124 unmodified lines
125 size[0] = linesizes[0] * height;125 size[0] = linesizes[0] * height;
126 126
127 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||127 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
128 desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {128 desc->flags & FF_PSEUDOPAL) {
129 data[1] = ptr + size[0]; /* palette is stored here as 256 32 bits words */129 data[1] = ptr + size[0]; /* palette is stored here as 256 32 bits words */
130 return size[0] + 256 * 4;130 return size[0] + 256 * 4;
131 }131 }
@@ -216,7 +216,7 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4], · 84 unmodified lines
216 av_free(buf);216 av_free(buf);
217 return ret;217 return ret;
218 }218 }
219 if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {219 if (desc->flags & AV_PIX_FMT_FLAG_PAL || (desc->flags & FF_PSEUDOPAL && pointers[1])) {
220 avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);220 avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);
221 if (align < 4) {221 if (align < 4) {
222 av_log(NULL, AV_LOG_ERROR, "Formats with a palette require a minimum alignment of 4\n");222 av_log(NULL, AV_LOG_ERROR, "Formats with a palette require a minimum alignment of 4\n");
@@ -225,7 +225,7 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4], · 2 unmodified lines
225 }225 }
226 226
227 if ((desc->flags & AV_PIX_FMT_FLAG_PAL ||227 if ((desc->flags & AV_PIX_FMT_FLAG_PAL ||
228 desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) &&228 desc->flags & FF_PSEUDOPAL) && pointers[1] &&
229 pointers[1] - pointers[0] > linesizes[0] * h) {229 pointers[1] - pointers[0] > linesizes[0] * h) {
230 /* zero-initialize the padding before the palette */230 /* zero-initialize the padding before the palette */
231 memset(pointers[0] + linesizes[0] * h, 0,231 memset(pointers[0] + linesizes[0] * h, 0,
@@ -354,12 +354,13 @@ static void image_copy(uint8_t *dst_data[4], const ptrdiff_t dst_linesizes[4], · 122 unmodified lines
354 return;354 return;
355 355
356 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||356 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
357 desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {357 desc->flags & FF_PSEUDOPAL) {
358 copy_plane(dst_data[0], dst_linesizes[0],358 copy_plane(dst_data[0], dst_linesizes[0],
359 src_data[0], src_linesizes[0],359 src_data[0], src_linesizes[0],
360 width, height);360 width, height);
361 /* copy the palette */361 /* copy the palette */
362 memcpy(dst_data[1], src_data[1], 4*256);362 if ((desc->flags & AV_PIX_FMT_FLAG_PAL) || (dst_data[1] && src_data[1]))
363 memcpy(dst_data[1], src_data[1], 4*256);
363 } else {364 } else {
364 int i, planes_nb = 0;365 int i, planes_nb = 0;
365 366
@@ -442,7 +443,7 @@ int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, · 76 unmodified lines
442 return ret;443 return ret;
443 444
444 // do not include palette for these pseudo-paletted formats445 // do not include palette for these pseudo-paletted formats
445 if (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)446 if (desc->flags & FF_PSEUDOPAL)
446 return FFALIGN(width, align) * height;447 return FFALIGN(width, align) * height;
447 448
448 return av_image_fill_arrays(data, linesize, NULL, pix_fmt,449 return av_image_fill_arrays(data, linesize, NULL, pix_fmt,
libavutil/internal.h+9−0
@@ -360,4 +360,13 @@ void ff_check_pixfmt_descriptors(void); · 359 unmodified lines
360 */360 */
361int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);361int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);
362 362
363// Helper macro for AV_PIX_FMT_FLAG_PSEUDOPAL deprecation. Code inside FFmpeg
364// should always use FF_PSEUDOPAL. Once the public API flag gets removed, all
365// code using it is dead code.
366#if FF_API_PSEUDOPAL
367#define FF_PSEUDOPAL AV_PIX_FMT_FLAG_PSEUDOPAL
368#else
369#define FF_PSEUDOPAL 0
370#endif
371
363#endif /* AVUTIL_INTERNAL_H */372#endif /* AVUTIL_INTERNAL_H */
libavutil/pixdesc.c+5−5
@@ -257,7 +257,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 256 unmodified lines
257 .comp = {257 .comp = {
258 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */258 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
259 },259 },
260 .flags = AV_PIX_FMT_FLAG_PSEUDOPAL,260 .flags = FF_PSEUDOPAL,
261 .alias = "gray8,y8",261 .alias = "gray8,y8",
262 },262 },
263 [AV_PIX_FMT_MONOWHITE] = {263 [AV_PIX_FMT_MONOWHITE] = {
@@ -362,7 +362,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 98 unmodified lines
362 { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */362 { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
363 { 0, 1, 0, 6, 2, 0, 1, 1 }, /* B */363 { 0, 1, 0, 6, 2, 0, 1, 1 }, /* B */
364 },364 },
365 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,365 .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
366 },366 },
367 [AV_PIX_FMT_BGR4] = {367 [AV_PIX_FMT_BGR4] = {
368 .name = "bgr4",368 .name = "bgr4",
@@ -386,7 +386,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 17 unmodified lines
386 { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */386 { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
387 { 0, 1, 0, 3, 1, 0, 0, 1 }, /* B */387 { 0, 1, 0, 3, 1, 0, 0, 1 }, /* B */
388 },388 },
389 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,389 .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
390 },390 },
391 [AV_PIX_FMT_RGB8] = {391 [AV_PIX_FMT_RGB8] = {
392 .name = "rgb8",392 .name = "rgb8",
@@ -398,7 +398,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 5 unmodified lines
398 { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */398 { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
399 { 0, 1, 0, 0, 3, 0, 2, 1 }, /* B */399 { 0, 1, 0, 0, 3, 0, 2, 1 }, /* B */
400 },400 },
401 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,401 .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
402 },402 },
403 [AV_PIX_FMT_RGB4] = {403 [AV_PIX_FMT_RGB4] = {
404 .name = "rgb4",404 .name = "rgb4",
@@ -422,7 +422,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 17 unmodified lines
422 { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */422 { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
423 { 0, 1, 0, 0, 1, 0, 0, 1 }, /* B */423 { 0, 1, 0, 0, 1, 0, 0, 1 }, /* B */
424 },424 },
425 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,425 .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
426 },426 },
427 [AV_PIX_FMT_NV12] = {427 [AV_PIX_FMT_NV12] = {
428 .name = "nv12",428 .name = "nv12",
libavutil/pixdesc.h+8−0
@@ -154,6 +154,14 @@ typedef struct AVPixFmtDescriptor { · 153 unmodified lines
154 * in some cases be simpler. Or the data can be interpreted purely based on154 * in some cases be simpler. Or the data can be interpreted purely based on
155 * the pixel format without using the palette.155 * the pixel format without using the palette.
156 * An example of a pseudo-paletted format is AV_PIX_FMT_GRAY8156 * An example of a pseudo-paletted format is AV_PIX_FMT_GRAY8
157 *
158 * @deprecated This flag is deprecated, and will be removed. When it is removed,
159 * the extra palette allocation in AVFrame.data[1] is removed as well. Only
160 * actual paletted formats (as indicated by AV_PIX_FMT_FLAG_PAL) will have a
161 * palette. Starting with FFmpeg versions which have this flag deprecated, the
162 * extra "pseudo" palette is already ignored, and API users are not required to
163 * allocate a palette for AV_PIX_FMT_FLAG_PSEUDOPAL formats (it was required
164 * before the deprecation, though).
157 */165 */
158#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6)166#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6)
159 167
libavutil/version.h+4−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
79 */79 */
80 80
81#define LIBAVUTIL_VERSION_MAJOR 5681#define LIBAVUTIL_VERSION_MAJOR 56
82#define LIBAVUTIL_VERSION_MINOR 1282#define LIBAVUTIL_VERSION_MINOR 13
83#define LIBAVUTIL_VERSION_MICRO 10083#define LIBAVUTIL_VERSION_MICRO 100
84 84
85#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \85#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -126,6 +126,9 @@ · 40 unmodified lines
126#ifndef FF_API_FRAME_GET_SET126#ifndef FF_API_FRAME_GET_SET
127#define FF_API_FRAME_GET_SET (LIBAVUTIL_VERSION_MAJOR < 57)127#define FF_API_FRAME_GET_SET (LIBAVUTIL_VERSION_MAJOR < 57)
128#endif128#endif
129#ifndef FF_API_PSEUDOPAL
130#define FF_API_PSEUDOPAL (LIBAVUTIL_VERSION_MAJOR < 57)
131#endif
129 132
130 133
131/**134/**
libswscale/swscale_internal.h+11−3
@@ -806,9 +806,17 @@ static av_always_inline int isPlanarRGB(enum AVPixelFormat pix_fmt) · 805 unmodified lines
806 806
807static av_always_inline int usePal(enum AVPixelFormat pix_fmt)807static av_always_inline int usePal(enum AVPixelFormat pix_fmt)
808{808{
809 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);809 switch (pix_fmt) {
810 av_assert0(desc);810 case AV_PIX_FMT_PAL8:
811 return (desc->flags & AV_PIX_FMT_FLAG_PAL) || (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL);811 case AV_PIX_FMT_BGR4_BYTE:
812 case AV_PIX_FMT_BGR8:
813 case AV_PIX_FMT_GRAY8:
814 case AV_PIX_FMT_RGB4_BYTE:
815 case AV_PIX_FMT_RGB8:
816 return 1;
817 default:
818 return 0;
819 }
812}820}
813 821
814extern const uint64_t ff_dither4[2];822extern const uint64_t ff_dither4[2];

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t