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
1515
1616 API changes, most recent first:
1717
18+2018-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+
1822 2018-04-01 - xxxxxxx - lavc 58.17.100 - avcodec.h
1923 Add av_packet_make_refcounted().
2024
fftools/ffprobe.c+2−0
@@ -3118,7 +3118,9 @@ static void ffprobe_show_pixel_formats(WriterContext *w) · 3117 unmodified lines
31183118 PRINT_PIX_FMT_FLAG(HWACCEL, "hwaccel");
31193119 PRINT_PIX_FMT_FLAG(PLANAR, "planar");
31203120 PRINT_PIX_FMT_FLAG(RGB, "rgb");
3121+#if FF_API_PSEUDOPAL
31213122 PRINT_PIX_FMT_FLAG(PSEUDOPAL, "pseudopal");
3123+#endif
31223124 PRINT_PIX_FMT_FLAG(ALPHA, "alpha");
31233125 writer_print_section_footer(w);
31243126 }
libavcodec/decode.c+1−4
@@ -1614,7 +1614,7 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic) · 1613 unmodified lines
16141614 pic->linesize[i] = 0;
16151615 }
16161616 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
1617− desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
1617+ ((desc->flags & FF_PSEUDOPAL) && pic->data[1]))
16181618 avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format);
16191619
16201620 if (s->debug & FF_DEBUG_BUFFERS)
@@ -1782,9 +1782,6 @@ static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame) · 161 unmodified lines
17821782 for (i = 0; i < num_planes; i++) {
17831783 av_assert0(frame->data[i]);
17841784 }
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;
17881785 // For formats without data like hwaccel allow unused pointers to be non-NULL.
17891786 for (i = num_planes; num_planes > 0 && i < FF_ARRAY_ELEMS(frame->data); i++) {
17901787 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
950950
951951 }
952952 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
953− desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
953+ desc->flags & FF_PSEUDOPAL) {
954954 dst[1] = p->data[1];
955955 src[1] = f->last_picture.f->data[1];
956956 }
libavcodec/rawdec.c+4−2
@@ -92,12 +92,14 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx) · 91 unmodified lines
9292 return AVERROR(EINVAL);
9393 }
9494
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)) {
9696 context->palette = av_buffer_alloc(AVPALETTE_SIZE);
9797 if (!context->palette)
9898 return AVERROR(ENOMEM);
99+#if FF_API_PSEUDOPAL
99100 if (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
100101 avpriv_set_systematic_pal2((uint32_t*)context->palette->data, avctx->pix_fmt);
102+#endif
101103 else {
102104 memset(context->palette->data, 0, AVPALETTE_SIZE);
103105 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
423425 }
424426
425427 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)) {
427429 frame->buf[1] = av_buffer_ref(context->palette);
428430 if (!frame->buf[1]) {
429431 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
7171 src_linesizes[i], h, nlines);
7272 }
7373 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
74− desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
74+ desc->flags & FF_PSEUDOPAL)
7575 dst_data[1] = src_data[1];
7676 }
7777
libavfilter/drawutils.c+1−1
@@ -184,7 +184,7 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags) · 183 unmodified lines
184184
185185 if (!desc || !desc->name)
186186 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))
188188 return AVERROR(ENOSYS);
189189 if (format == AV_PIX_FMT_P010LE || format == AV_PIX_FMT_P010BE || format == AV_PIX_FMT_P016LE || format == AV_PIX_FMT_P016BE)
190190 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
103103 }
104104
105105 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
106− desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
106+ desc->flags & FF_PSEUDOPAL) {
107107 pool->pools[1] = av_buffer_pool_init(AVPALETTE_SIZE, alloc);
108108 if (!pool->pools[1])
109109 goto fail;
@@ -227,7 +227,7 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool) · 117 unmodified lines
227227 }
228228
229229 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
230− desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
230+ desc->flags & FF_PSEUDOPAL) {
231231 enum AVPixelFormat format =
232232 pool->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : pool->format;
233233
libavfilter/vf_crop.c+1−1
@@ -288,7 +288,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) · 287 unmodified lines
288288 frame->data[0] += s->y * frame->linesize[0];
289289 frame->data[0] += s->x * s->max_step[0];
290290
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)) {
292292 for (i = 1; i < 3; i ++) {
293293 if (frame->data[i]) {
294294 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
8181
8282 /* copy palette */
8383 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]))
8585 memcpy(out->data[1], in->data[1], AVPALETTE_SIZE);
8686
8787 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
261261
262262 /* TODO: make algorithm configurable */
263263
264− scale->input_is_pal = desc->flags & AV_PIX_FMT_FLAG_PAL ||
265− desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL;
264+ scale->input_is_pal = desc->flags & AV_PIX_FMT_FLAG_PAL;
266265 if (outfmt == AV_PIX_FMT_PAL8) outfmt = AV_PIX_FMT_BGR8;
267266 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;
269268
270269 if (scale->sws)
271270 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
6969 }
7070
7171 if ((desc->flags & AV_PIX_FMT_FLAG_PAL ||
72− desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) &&
72+ desc->flags & FF_PSEUDOPAL) &&
7373 (i == 1) != (s->map[i] == 1)) {
7474 av_log(ctx, AV_LOG_ERROR,
7575 "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
247247
248248 frame->data[i] = frame->buf[i]->data;
249249 }
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) {
251251 av_buffer_unref(&frame->buf[1]);
252252 frame->buf[1] = av_buffer_alloc(AVPALETTE_SIZE);
253253 if (!frame->buf[1])
@@ -848,7 +848,7 @@ static int calc_cropping_offsets(size_t offsets[4], const AVFrame *frame, · 594 unmodified lines
848848 int shift_x = (i == 1 || i == 2) ? desc->log2_chroma_w : 0;
849849 int shift_y = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
850850
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) {
852852 offsets[i] = 0;
853853 break;
854854 }
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
125125 size[0] = linesizes[0] * height;
126126
127127 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
128− desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
128+ desc->flags & FF_PSEUDOPAL) {
129129 data[1] = ptr + size[0]; /* palette is stored here as 256 32 bits words */
130130 return size[0] + 256 * 4;
131131 }
@@ -216,7 +216,7 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4], · 84 unmodified lines
216216 av_free(buf);
217217 return ret;
218218 }
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])) {
220220 avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);
221221 if (align < 4) {
222222 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
225225 }
226226
227227 if ((desc->flags & AV_PIX_FMT_FLAG_PAL ||
228− desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) &&
228+ desc->flags & FF_PSEUDOPAL) && pointers[1] &&
229229 pointers[1] - pointers[0] > linesizes[0] * h) {
230230 /* zero-initialize the padding before the palette */
231231 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
354354 return;
355355
356356 if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
357− desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
357+ desc->flags & FF_PSEUDOPAL) {
358358 copy_plane(dst_data[0], dst_linesizes[0],
359359 src_data[0], src_linesizes[0],
360360 width, height);
361361 /* 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);
363364 } else {
364365 int i, planes_nb = 0;
365366
@@ -442,7 +443,7 @@ int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, · 76 unmodified lines
442443 return ret;
443444
444445 // do not include palette for these pseudo-paletted formats
445− if (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
446+ if (desc->flags & FF_PSEUDOPAL)
446447 return FFALIGN(width, align) * height;
447448
448449 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
360360 */
361361 int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);
362362
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+
363372 #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
257257 .comp = {
258258 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
259259 },
260− .flags = AV_PIX_FMT_FLAG_PSEUDOPAL,
260+ .flags = FF_PSEUDOPAL,
261261 .alias = "gray8,y8",
262262 },
263263 [AV_PIX_FMT_MONOWHITE] = {
@@ -362,7 +362,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 98 unmodified lines
362362 { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
363363 { 0, 1, 0, 6, 2, 0, 1, 1 }, /* B */
364364 },
365− .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
365+ .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
366366 },
367367 [AV_PIX_FMT_BGR4] = {
368368 .name = "bgr4",
@@ -386,7 +386,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 17 unmodified lines
386386 { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
387387 { 0, 1, 0, 3, 1, 0, 0, 1 }, /* B */
388388 },
389− .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
389+ .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
390390 },
391391 [AV_PIX_FMT_RGB8] = {
392392 .name = "rgb8",
@@ -398,7 +398,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 5 unmodified lines
398398 { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
399399 { 0, 1, 0, 0, 3, 0, 2, 1 }, /* B */
400400 },
401− .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
401+ .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
402402 },
403403 [AV_PIX_FMT_RGB4] = {
404404 .name = "rgb4",
@@ -422,7 +422,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 17 unmodified lines
422422 { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
423423 { 0, 1, 0, 0, 1, 0, 0, 1 }, /* B */
424424 },
425− .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
425+ .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
426426 },
427427 [AV_PIX_FMT_NV12] = {
428428 .name = "nv12",
libavutil/pixdesc.h+8−0
@@ -154,6 +154,14 @@ typedef struct AVPixFmtDescriptor { · 153 unmodified lines
154154 * in some cases be simpler. Or the data can be interpreted purely based on
155155 * the pixel format without using the palette.
156156 * 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).
157165 */
158166 #define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6)
159167
libavutil/version.h+4−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
7979 */
8080
8181 #define LIBAVUTIL_VERSION_MAJOR 56
82−#define LIBAVUTIL_VERSION_MINOR 12
82+#define LIBAVUTIL_VERSION_MINOR 13
8383 #define LIBAVUTIL_VERSION_MICRO 100
8484
8585 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -126,6 +126,9 @@ · 40 unmodified lines
126126 #ifndef FF_API_FRAME_GET_SET
127127 #define FF_API_FRAME_GET_SET (LIBAVUTIL_VERSION_MAJOR < 57)
128128 #endif
129+#ifndef FF_API_PSEUDOPAL
130+#define FF_API_PSEUDOPAL (LIBAVUTIL_VERSION_MAJOR < 57)
131+#endif
129132
130133
131134 /**
libswscale/swscale_internal.h+11−3
@@ -806,9 +806,17 @@ static av_always_inline int isPlanarRGB(enum AVPixelFormat pix_fmt) · 805 unmodified lines
806806
807807 static av_always_inline int usePal(enum AVPixelFormat pix_fmt)
808808 {
809− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
810− av_assert0(desc);
811− return (desc->flags & AV_PIX_FMT_FLAG_PAL) || (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL);
809+ switch (pix_fmt) {
810+ case AV_PIX_FMT_PAL8:
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+ }
812820 }
813821
814822 extern 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