Commit e6c4ac7b authored by Anton Khirnov's avatar Anton Khirnov

pixdesc: rename PIX_FMT_* flags to AV_PIX_FMT_FLAG_*

parent 7c57a582
...@@ -1161,11 +1161,11 @@ int show_pix_fmts(void *optctx, const char *opt, const char *arg) ...@@ -1161,11 +1161,11 @@ int show_pix_fmts(void *optctx, const char *opt, const char *arg)
while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) { while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc); enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
printf("%c%c%c%c%c %-16s %d %2d\n", printf("%c%c%c%c%c %-16s %d %2d\n",
sws_isSupportedInput (pix_fmt) ? 'I' : '.', sws_isSupportedInput (pix_fmt) ? 'I' : '.',
sws_isSupportedOutput(pix_fmt) ? 'O' : '.', sws_isSupportedOutput(pix_fmt) ? 'O' : '.',
pix_desc->flags & PIX_FMT_HWACCEL ? 'H' : '.', pix_desc->flags & AV_PIX_FMT_FLAG_HWACCEL ? 'H' : '.',
pix_desc->flags & PIX_FMT_PAL ? 'P' : '.', pix_desc->flags & AV_PIX_FMT_FLAG_PAL ? 'P' : '.',
pix_desc->flags & PIX_FMT_BITSTREAM ? 'B' : '.', pix_desc->flags & AV_PIX_FMT_FLAG_BITSTREAM ? 'B' : '.',
pix_desc->name, pix_desc->name,
pix_desc->nb_components, pix_desc->nb_components,
av_get_bits_per_pixel(pix_desc)); av_get_bits_per_pixel(pix_desc));
......
...@@ -13,6 +13,9 @@ libavutil: 2012-10-22 ...@@ -13,6 +13,9 @@ libavutil: 2012-10-22
API changes, most recent first: API changes, most recent first:
2013-05-xx - xxxxxxx - lavu 52.11.0 - pixdesc.h
Replace PIX_FMT_* flags with AV_PIX_FMT_FLAG_*.
2013-04-xx - xxxxxxx - lavc 55.4.0 - avcodec.h 2013-04-xx - xxxxxxx - lavc 55.4.0 - avcodec.h
Add field_order to AVCodecParserContext. Add field_order to AVCodecParserContext.
......
...@@ -75,7 +75,7 @@ int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt, ...@@ -75,7 +75,7 @@ int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt,
} }
} }
if (desc->flags & PIX_FMT_PAL) if (desc->flags & AV_PIX_FMT_FLAG_PAL)
memcpy((unsigned char *)(((size_t)dest + 3) & ~3), memcpy((unsigned char *)(((size_t)dest + 3) & ~3),
src->data[1], 256 * 4); src->data[1], 256 * 4);
...@@ -92,7 +92,7 @@ int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height) ...@@ -92,7 +92,7 @@ int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height)
return AVERROR(EINVAL); return AVERROR(EINVAL);
if ((ret = av_image_check_size(width, height, 0, NULL)) < 0) if ((ret = av_image_check_size(width, height, 0, NULL)) < 0)
return ret; return ret;
if (desc->flags & PIX_FMT_PSEUDOPAL) if (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
// do not include palette for these pseudo-paletted formats // do not include palette for these pseudo-paletted formats
return width * height; return width * height;
return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height); return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height);
......
...@@ -335,7 +335,7 @@ static int decode_slice(AVCodecContext *c, void *arg) ...@@ -335,7 +335,7 @@ static int decode_slice(AVCodecContext *c, void *arg)
FFV1Context *fs = *(void **)arg; FFV1Context *fs = *(void **)arg;
FFV1Context *f = fs->avctx->priv_data; FFV1Context *f = fs->avctx->priv_data;
int width, height, x, y, ret; int width, height, x, y, ret;
const int ps = (av_pix_fmt_desc_get(c->pix_fmt)->flags & PIX_FMT_PLANAR) const int ps = (av_pix_fmt_desc_get(c->pix_fmt)->flags & AV_PIX_FMT_FLAG_PLANAR)
? (c->bits_per_raw_sample > 8) + 1 ? (c->bits_per_raw_sample > 8) + 1
: 4; : 4;
AVFrame *const p = f->cur; AVFrame *const p = f->cur;
......
...@@ -875,7 +875,7 @@ static int encode_slice(AVCodecContext *c, void *arg) ...@@ -875,7 +875,7 @@ static int encode_slice(AVCodecContext *c, void *arg)
int x = fs->slice_x; int x = fs->slice_x;
int y = fs->slice_y; int y = fs->slice_y;
AVFrame *const p = &f->picture; AVFrame *const p = &f->picture;
const int ps = (av_pix_fmt_desc_get(c->pix_fmt)->flags & PIX_FMT_PLANAR) const int ps = (av_pix_fmt_desc_get(c->pix_fmt)->flags & AV_PIX_FMT_FLAG_PLANAR)
? (f->bits_per_raw_sample > 8) + 1 ? (f->bits_per_raw_sample > 8) + 1
: 4; : 4;
......
...@@ -60,7 +60,7 @@ void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int ...@@ -60,7 +60,7 @@ void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int
static int is_gray(const AVPixFmtDescriptor *desc) static int is_gray(const AVPixFmtDescriptor *desc)
{ {
return desc->nb_components - (desc->flags & PIX_FMT_ALPHA) == 1; return desc->nb_components - (desc->flags & AV_PIX_FMT_FLAG_ALPHA) == 1;
} }
int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
...@@ -86,11 +86,11 @@ int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, ...@@ -86,11 +86,11 @@ int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
dst_desc->log2_chroma_h > src_desc->log2_chroma_h) dst_desc->log2_chroma_h > src_desc->log2_chroma_h)
loss |= FF_LOSS_RESOLUTION; loss |= FF_LOSS_RESOLUTION;
if ((src_desc->flags & PIX_FMT_RGB) != (dst_desc->flags & PIX_FMT_RGB)) if ((src_desc->flags & AV_PIX_FMT_FLAG_RGB) != (dst_desc->flags & AV_PIX_FMT_FLAG_RGB))
loss |= FF_LOSS_COLORSPACE; loss |= FF_LOSS_COLORSPACE;
if (has_alpha && !(dst_desc->flags & PIX_FMT_ALPHA) && if (has_alpha && !(dst_desc->flags & AV_PIX_FMT_FLAG_ALPHA) &&
(dst_desc->flags & PIX_FMT_ALPHA)) (dst_desc->flags & AV_PIX_FMT_FLAG_ALPHA))
loss |= FF_LOSS_ALPHA; loss |= FF_LOSS_ALPHA;
if (dst_pix_fmt == AV_PIX_FMT_PAL8 && !is_gray(src_desc)) if (dst_pix_fmt == AV_PIX_FMT_PAL8 && !is_gray(src_desc))
...@@ -260,8 +260,8 @@ void ff_shrink88(uint8_t *dst, int dst_wrap, ...@@ -260,8 +260,8 @@ void ff_shrink88(uint8_t *dst, int dst_wrap,
/* return true if yuv planar */ /* return true if yuv planar */
static inline int is_yuv_planar(const AVPixFmtDescriptor *desc) static inline int is_yuv_planar(const AVPixFmtDescriptor *desc)
{ {
return (!(desc->flags & PIX_FMT_RGB) && return (!(desc->flags & AV_PIX_FMT_FLAG_RGB) &&
(desc->flags & PIX_FMT_PLANAR)); (desc->flags & AV_PIX_FMT_FLAG_PLANAR));
} }
int av_picture_crop(AVPicture *dst, const AVPicture *src, int av_picture_crop(AVPicture *dst, const AVPicture *src,
......
...@@ -173,7 +173,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s) ...@@ -173,7 +173,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
}else }else
s->maxval=1; s->maxval=1;
/* more check if YUV420 */ /* more check if YUV420 */
if (av_pix_fmt_desc_get(avctx->pix_fmt)->flags & PIX_FMT_PLANAR) { if (av_pix_fmt_desc_get(avctx->pix_fmt)->flags & AV_PIX_FMT_FLAG_PLANAR) {
if ((avctx->width & 1) != 0) if ((avctx->width & 1) != 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
h = (avctx->height * 2); h = (avctx->height * 2);
......
...@@ -98,11 +98,11 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx) ...@@ -98,11 +98,11 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
if (desc->flags & (PIX_FMT_PAL | PIX_FMT_PSEUDOPAL)) { if (desc->flags & (AV_PIX_FMT_FLAG_PAL | AV_PIX_FMT_FLAG_PSEUDOPAL)) {
context->palette = av_buffer_alloc(AVPALETTE_SIZE); context->palette = av_buffer_alloc(AVPALETTE_SIZE);
if (!context->palette) if (!context->palette)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
if (desc->flags & PIX_FMT_PSEUDOPAL) if (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
avpriv_set_systematic_pal2((uint32_t*)context->palette->data, avctx->pix_fmt); avpriv_set_systematic_pal2((uint32_t*)context->palette->data, avctx->pix_fmt);
else else
memset(context->palette->data, 0, AVPALETTE_SIZE); memset(context->palette->data, 0, AVPALETTE_SIZE);
...@@ -210,7 +210,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -210,7 +210,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
} }
if ((avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) || if ((avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) ||
(desc->flags & PIX_FMT_PSEUDOPAL)) { (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)) {
frame->buf[1] = av_buffer_ref(context->palette); frame->buf[1] = av_buffer_ref(context->palette);
if (!frame->buf[1]) if (!frame->buf[1])
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
......
...@@ -242,9 +242,9 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt, ...@@ -242,9 +242,9 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
case AV_PIX_FMT_PAL8: case AV_PIX_FMT_PAL8:
pfd = av_pix_fmt_desc_get(avctx->pix_fmt); pfd = av_pix_fmt_desc_get(avctx->pix_fmt);
s->bpp = av_get_bits_per_pixel(pfd); s->bpp = av_get_bits_per_pixel(pfd);
if (pfd->flags & PIX_FMT_PAL) { if (pfd->flags & AV_PIX_FMT_FLAG_PAL) {
s->photometric_interpretation = 3; s->photometric_interpretation = 3;
} else if (pfd->flags & PIX_FMT_RGB) { } else if (pfd->flags & AV_PIX_FMT_FLAG_RGB) {
s->photometric_interpretation = 2; s->photometric_interpretation = 2;
} else { } else {
s->photometric_interpretation = 1; s->photometric_interpretation = 1;
......
...@@ -663,7 +663,7 @@ do { \ ...@@ -663,7 +663,7 @@ do { \
planes = av_pix_fmt_count_planes(frame->format); planes = av_pix_fmt_count_planes(frame->format);
/* workaround for AVHWAccel plane count of 0, buf[0] is used as /* workaround for AVHWAccel plane count of 0, buf[0] is used as
check for allocated buffers: make libavcodec happy */ check for allocated buffers: make libavcodec happy */
if (desc && desc->flags & PIX_FMT_HWACCEL) if (desc && desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
planes = 1; planes = 1;
if (!desc || planes <= 0) { if (!desc || planes <= 0) {
ret = AVERROR(EINVAL); ret = AVERROR(EINVAL);
...@@ -793,7 +793,7 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, ...@@ -793,7 +793,7 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2,
static int is_hwaccel_pix_fmt(enum AVPixelFormat pix_fmt) static int is_hwaccel_pix_fmt(enum AVPixelFormat pix_fmt)
{ {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
return desc->flags & PIX_FMT_HWACCEL; return desc->flags & AV_PIX_FMT_FLAG_HWACCEL;
} }
enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat *fmt) enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat *fmt)
......
...@@ -51,7 +51,7 @@ static int xwd_encode_frame(AVCodecContext *avctx, AVPacket *pkt, ...@@ -51,7 +51,7 @@ static int xwd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
uint8_t *ptr, *buf; uint8_t *ptr, *buf;
pixdepth = av_get_bits_per_pixel(desc); pixdepth = av_get_bits_per_pixel(desc);
if (desc->flags & PIX_FMT_BE) if (desc->flags & AV_PIX_FMT_FLAG_BE)
be = 1; be = 1;
switch (pix_fmt) { switch (pix_fmt) {
case AV_PIX_FMT_ARGB: case AV_PIX_FMT_ARGB:
......
...@@ -216,7 +216,7 @@ AVFilterFormats *ff_all_formats(enum AVMediaType type) ...@@ -216,7 +216,7 @@ AVFilterFormats *ff_all_formats(enum AVMediaType type)
for (fmt = 0; fmt < num_formats; fmt++) { for (fmt = 0; fmt < num_formats; fmt++) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
if ((type != AVMEDIA_TYPE_VIDEO) || if ((type != AVMEDIA_TYPE_VIDEO) ||
(type == AVMEDIA_TYPE_VIDEO && !(desc->flags & PIX_FMT_HWACCEL))) (type == AVMEDIA_TYPE_VIDEO && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)))
ff_add_format(&ret, fmt); ff_add_format(&ret, fmt);
} }
......
...@@ -261,7 +261,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) ...@@ -261,7 +261,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
frame->data[0] += crop->y * frame->linesize[0]; frame->data[0] += crop->y * frame->linesize[0];
frame->data[0] += crop->x * crop->max_step[0]; frame->data[0] += crop->x * crop->max_step[0];
if (!(desc->flags & PIX_FMT_PAL || desc->flags & PIX_FMT_PSEUDOPAL)) { if (!(desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)) {
for (i = 1; i < 3; i ++) { for (i = 1; i < 3; i ++) {
if (frame->data[i]) { if (frame->data[i]) {
frame->data[i] += (crop->y >> crop->vsub) * frame->linesize[i]; frame->data[i] += (crop->y >> crop->vsub) * frame->linesize[i];
......
...@@ -56,8 +56,8 @@ static int query_formats(AVFilterContext *ctx) ...@@ -56,8 +56,8 @@ static int query_formats(AVFilterContext *ctx)
formats = NULL; formats = NULL;
for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++) { for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
if (!(desc->flags & PIX_FMT_HWACCEL || if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL ||
desc->flags & PIX_FMT_BITSTREAM) && desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) &&
desc->nb_components && !desc->log2_chroma_h && desc->nb_components && !desc->log2_chroma_h &&
(ret = ff_add_format(&formats, pix_fmt)) < 0) { (ret = ff_add_format(&formats, pix_fmt)) < 0) {
ff_formats_unref(&formats); ff_formats_unref(&formats);
......
...@@ -78,8 +78,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) ...@@ -78,8 +78,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
} }
/* copy palette */ /* copy palette */
if (priv->pix_desc->flags & PIX_FMT_PAL || if (priv->pix_desc->flags & AV_PIX_FMT_FLAG_PAL ||
priv->pix_desc->flags & PIX_FMT_PSEUDOPAL) priv->pix_desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
memcpy(out->data[1], in->data[1], 256*4); memcpy(out->data[1], in->data[1], 256*4);
for (c = 0; c < priv->pix_desc->nb_components; c++) { for (c = 0; c < priv->pix_desc->nb_components; c++) {
......
...@@ -220,8 +220,8 @@ static int config_props(AVFilterLink *outlink) ...@@ -220,8 +220,8 @@ static int config_props(AVFilterLink *outlink)
outlink->w, outlink->h, av_get_pix_fmt_name(outlink->format), outlink->w, outlink->h, av_get_pix_fmt_name(outlink->format),
scale->flags); scale->flags);
scale->input_is_pal = desc->flags & PIX_FMT_PAL || scale->input_is_pal = desc->flags & AV_PIX_FMT_FLAG_PAL ||
desc->flags & PIX_FMT_PSEUDOPAL; desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL;
if (scale->sws) if (scale->sws)
sws_freeContext(scale->sws); sws_freeContext(scale->sws);
......
...@@ -93,7 +93,7 @@ static int get_video_buffer(AVFrame *frame, int align) ...@@ -93,7 +93,7 @@ static int get_video_buffer(AVFrame *frame, int align)
frame->data[i] = frame->buf[i]->data; frame->data[i] = frame->buf[i]->data;
} }
if (desc->flags & PIX_FMT_PAL || desc->flags & PIX_FMT_PSEUDOPAL) { if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
av_buffer_unref(&frame->buf[1]); av_buffer_unref(&frame->buf[1]);
frame->buf[1] = av_buffer_alloc(1024); frame->buf[1] = av_buffer_alloc(1024);
if (!frame->buf[1]) if (!frame->buf[1])
......
...@@ -55,7 +55,7 @@ int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane) ...@@ -55,7 +55,7 @@ int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane)
if (!desc) if (!desc)
return AVERROR(EINVAL); return AVERROR(EINVAL);
if (desc->flags & PIX_FMT_BITSTREAM) if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
return (width * (desc->comp[0].step_minus1+1) + 7) >> 3; return (width * (desc->comp[0].step_minus1+1) + 7) >> 3;
av_image_fill_max_pixsteps(max_step, max_step_comp, desc); av_image_fill_max_pixsteps(max_step, max_step_comp, desc);
...@@ -72,10 +72,10 @@ int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int wi ...@@ -72,10 +72,10 @@ int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int wi
memset(linesizes, 0, 4*sizeof(linesizes[0])); memset(linesizes, 0, 4*sizeof(linesizes[0]));
if (!desc || desc->flags & PIX_FMT_HWACCEL) if (!desc || desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
return AVERROR(EINVAL); return AVERROR(EINVAL);
if (desc->flags & PIX_FMT_BITSTREAM) { if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
if (width > (INT_MAX -7) / (desc->comp[0].step_minus1+1)) if (width > (INT_MAX -7) / (desc->comp[0].step_minus1+1))
return AVERROR(EINVAL); return AVERROR(EINVAL);
linesizes[0] = (width * (desc->comp[0].step_minus1+1) + 7) >> 3; linesizes[0] = (width * (desc->comp[0].step_minus1+1) + 7) >> 3;
...@@ -102,7 +102,7 @@ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei ...@@ -102,7 +102,7 @@ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
memset(data , 0, sizeof(data[0])*4); memset(data , 0, sizeof(data[0])*4);
if (!desc || desc->flags & PIX_FMT_HWACCEL) if (!desc || desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
return AVERROR(EINVAL); return AVERROR(EINVAL);
data[0] = ptr; data[0] = ptr;
...@@ -110,8 +110,8 @@ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei ...@@ -110,8 +110,8 @@ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei
return AVERROR(EINVAL); return AVERROR(EINVAL);
size[0] = linesizes[0] * height; size[0] = linesizes[0] * height;
if (desc->flags & PIX_FMT_PAL || if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
desc->flags & PIX_FMT_PSEUDOPAL) { desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
size[0] = (size[0] + 3) & ~3; size[0] = (size[0] + 3) & ~3;
data[1] = ptr + size[0]; /* palette is stored here as 256 32 bits words */ data[1] = ptr + size[0]; /* palette is stored here as 256 32 bits words */
return size[0] + 256 * 4; return size[0] + 256 * 4;
...@@ -203,7 +203,7 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4], ...@@ -203,7 +203,7 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
av_free(buf); av_free(buf);
return ret; return ret;
} }
if (desc->flags & PIX_FMT_PAL || desc->flags & PIX_FMT_PSEUDOPAL) if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt); avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);
return ret; return ret;
...@@ -247,11 +247,11 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], ...@@ -247,11 +247,11 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
{ {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
if (!desc || desc->flags & PIX_FMT_HWACCEL) if (!desc || desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
return; return;
if (desc->flags & PIX_FMT_PAL || if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
desc->flags & PIX_FMT_PSEUDOPAL) { desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
av_image_copy_plane(dst_data[0], dst_linesizes[0], av_image_copy_plane(dst_data[0], dst_linesizes[0],
src_data[0], src_linesizes[0], src_data[0], src_linesizes[0],
width, height); width, height);
......
This diff is collapsed.
...@@ -83,21 +83,54 @@ typedef struct AVPixFmtDescriptor{ ...@@ -83,21 +83,54 @@ typedef struct AVPixFmtDescriptor{
AVComponentDescriptor comp[4]; AVComponentDescriptor comp[4];
}AVPixFmtDescriptor; }AVPixFmtDescriptor;
#define PIX_FMT_BE 1 ///< Pixel format is big-endian. /**
#define PIX_FMT_PAL 2 ///< Pixel format has a palette in data[1], values are indexes in this palette. * Pixel format is big-endian.
#define PIX_FMT_BITSTREAM 4 ///< All values of a component are bit-wise packed end to end. */
#define PIX_FMT_HWACCEL 8 ///< Pixel format is an HW accelerated format. #define AV_PIX_FMT_FLAG_BE (1 << 0)
#define PIX_FMT_PLANAR 16 ///< At least one pixel component is not in the first data plane /**
#define PIX_FMT_RGB 32 ///< The pixel format contains RGB-like data (as opposed to YUV/grayscale) * Pixel format has a palette in data[1], values are indexes in this palette.
*/
#define AV_PIX_FMT_FLAG_PAL (1 << 1)
/**
* All values of a component are bit-wise packed end to end.
*/
#define AV_PIX_FMT_FLAG_BITSTREAM (1 << 2)
/**
* Pixel format is an HW accelerated format.
*/
#define AV_PIX_FMT_FLAG_HWACCEL (1 << 3)
/**
* At least one pixel component is not in the first data plane.
*/
#define AV_PIX_FMT_FLAG_PLANAR (1 << 4)
/**
* The pixel format contains RGB-like data (as opposed to YUV/grayscale).
*/
#define AV_PIX_FMT_FLAG_RGB (1 << 5)
/** /**
* The pixel format is "pseudo-paletted". This means that Libav treats it as * The pixel format is "pseudo-paletted". This means that Libav treats it as
* paletted internally, but the palette is generated by the decoder and is not * paletted internally, but the palette is generated by the decoder and is not
* stored in the file. * stored in the file.
*/ */
#define PIX_FMT_PSEUDOPAL 64 #define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6)
/**
#define PIX_FMT_ALPHA 128 ///< The pixel format has an alpha channel * The pixel format has an alpha channel.
*/
#define AV_PIX_FMT_FLAG_ALPHA (1 << 7)
#if FF_API_PIX_FMT
/**
* @deprecate use the AV_PIX_FMT_FLAG_* flags
*/
#define PIX_FMT_BE AV_PIX_FMT_FLAG_BE
#define PIX_FMT_PAL AV_PIX_FMT_FLAG_PAL
#define PIX_FMT_BITSTREAM AV_PIX_FMT_FLAG_BITSTREAM
#define PIX_FMT_HWACCEL AV_PIX_FMT_FLAG_HWACCEL
#define PIX_FMT_PLANAR AV_PIX_FMT_FLAG_PLANAR
#define PIX_FMT_RGB AV_PIX_FMT_FLAG_RGB
#define PIX_FMT_PSEUDOPAL AV_PIX_FMT_FLAG_PSEUDOPAL
#define PIX_FMT_ALPHA AV_PIX_FMT_FLAG_ALPHA
#endif
#if FF_API_PIX_FMT_DESC #if FF_API_PIX_FMT_DESC
/** /**
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
*/ */
#define LIBAVUTIL_VERSION_MAJOR 52 #define LIBAVUTIL_VERSION_MAJOR 52
#define LIBAVUTIL_VERSION_MINOR 10 #define LIBAVUTIL_VERSION_MINOR 11
#define LIBAVUTIL_VERSION_MICRO 1 #define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \ LIBAVUTIL_VERSION_MINOR, \
......
...@@ -596,33 +596,33 @@ static av_always_inline int isBE(enum AVPixelFormat pix_fmt) ...@@ -596,33 +596,33 @@ static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
{ {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
av_assert0(desc); av_assert0(desc);
return desc->flags & PIX_FMT_BE; return desc->flags & AV_PIX_FMT_FLAG_BE;
} }
static av_always_inline int isYUV(enum AVPixelFormat pix_fmt) static av_always_inline int isYUV(enum AVPixelFormat pix_fmt)
{ {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
av_assert0(desc); av_assert0(desc);
return !(desc->flags & PIX_FMT_RGB) && desc->nb_components >= 2; return !(desc->flags & AV_PIX_FMT_FLAG_RGB) && desc->nb_components >= 2;
} }
static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt) static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt)
{ {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
av_assert0(desc); av_assert0(desc);
return ((desc->flags & PIX_FMT_PLANAR) && isYUV(pix_fmt)); return ((desc->flags & AV_PIX_FMT_FLAG_PLANAR) && isYUV(pix_fmt));
} }
static av_always_inline int isRGB(enum AVPixelFormat pix_fmt) static av_always_inline int isRGB(enum AVPixelFormat pix_fmt)
{ {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
av_assert0(desc); av_assert0(desc);
return (desc->flags & PIX_FMT_RGB); return (desc->flags & AV_PIX_FMT_FLAG_RGB);
} }
#if 0 // FIXME #if 0 // FIXME
#define isGray(x) \ #define isGray(x) \
(!(av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) && \ (!(av_pix_fmt_descriptors[x].flags & AV_PIX_FMT_FLAG_PAL) && \
av_pix_fmt_descriptors[x].nb_components <= 2) av_pix_fmt_descriptors[x].nb_components <= 2)
#else #else
#define isGray(x) \ #define isGray(x) \
...@@ -683,7 +683,7 @@ static av_always_inline int isPacked(enum AVPixelFormat pix_fmt) ...@@ -683,7 +683,7 @@ static av_always_inline int isPacked(enum AVPixelFormat pix_fmt)
{ {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
av_assert0(desc); av_assert0(desc);
return ((desc->nb_components >= 2 && !(desc->flags & PIX_FMT_PLANAR)) || return ((desc->nb_components >= 2 && !(desc->flags & AV_PIX_FMT_FLAG_PLANAR)) ||
pix_fmt == AV_PIX_FMT_PAL8); pix_fmt == AV_PIX_FMT_PAL8);
} }
...@@ -691,29 +691,29 @@ static av_always_inline int isPlanar(enum AVPixelFormat pix_fmt) ...@@ -691,29 +691,29 @@ static av_always_inline int isPlanar(enum AVPixelFormat pix_fmt)
{ {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
av_assert0(desc); av_assert0(desc);
return (desc->nb_components >= 2 && (desc->flags & PIX_FMT_PLANAR)); return (desc->nb_components >= 2 && (desc->flags & AV_PIX_FMT_FLAG_PLANAR));
} }
static av_always_inline int isPackedRGB(enum AVPixelFormat pix_fmt) static av_always_inline int isPackedRGB(enum AVPixelFormat pix_fmt)
{ {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
av_assert0(desc); av_assert0(desc);
return ((desc->flags & (PIX_FMT_PLANAR | PIX_FMT_RGB)) == PIX_FMT_RGB); return ((desc->flags & (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB)) == AV_PIX_FMT_FLAG_RGB);
} }
static av_always_inline int isPlanarRGB(enum AVPixelFormat pix_fmt) static av_always_inline int isPlanarRGB(enum AVPixelFormat pix_fmt)
{ {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
av_assert0(desc); av_assert0(desc);
return ((desc->flags & (PIX_FMT_PLANAR | PIX_FMT_RGB)) == return ((desc->flags & (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB)) ==
(PIX_FMT_PLANAR | PIX_FMT_RGB)); (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB));
} }
static av_always_inline int usePal(enum AVPixelFormat pix_fmt) static av_always_inline int usePal(enum AVPixelFormat pix_fmt)
{ {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
av_assert0(desc); av_assert0(desc);
return ((desc->flags & PIX_FMT_PAL) || (desc->flags & PIX_FMT_PSEUDOPAL) || return ((desc->flags & AV_PIX_FMT_FLAG_PAL) || (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) ||
pix_fmt == AV_PIX_FMT_Y400A); pix_fmt == AV_PIX_FMT_Y400A);
} }
......
...@@ -563,7 +563,7 @@ static rgbConvFn findRgbConvFn(SwsContext *c) ...@@ -563,7 +563,7 @@ static rgbConvFn findRgbConvFn(SwsContext *c)
#define IS_NOT_NE(bpp, desc) \ #define IS_NOT_NE(bpp, desc) \
(((bpp + 7) >> 3) == 2 && \ (((bpp + 7) >> 3) == 2 && \
(!(desc->flags & PIX_FMT_BE) != !HAVE_BIGENDIAN)) (!(desc->flags & AV_PIX_FMT_FLAG_BE) != !HAVE_BIGENDIAN))
/* if this is non-native rgb444/555/565, don't handle it here. */ /* if this is non-native rgb444/555/565, don't handle it here. */
if (IS_NOT_NE(srcId, desc_src) || IS_NOT_NE(dstId, desc_dst)) if (IS_NOT_NE(srcId, desc_src) || IS_NOT_NE(dstId, desc_dst))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment