mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
dpxenc: simplifiy code using AVPixFmtDescriptor
Update rgb24 fate test as it no longer writes image in big endian format. Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
22a038606c
commit
ae9ef151ad
@ -35,40 +35,27 @@ typedef struct DPXContext {
|
|||||||
static av_cold int encode_init(AVCodecContext *avctx)
|
static av_cold int encode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
DPXContext *s = avctx->priv_data;
|
DPXContext *s = avctx->priv_data;
|
||||||
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||||
|
|
||||||
s->big_endian = 1;
|
s->big_endian = !!(desc->flags & PIX_FMT_BE);
|
||||||
s->bits_per_component = 8;
|
s->bits_per_component = desc->comp[0].depth_minus1 + 1;
|
||||||
s->descriptor = 50; /* RGB */
|
s->descriptor = (desc->flags & PIX_FMT_ALPHA) ? 51 : 50;
|
||||||
s->planar = 0;
|
s->planar = !!(desc->flags & PIX_FMT_PLANAR);
|
||||||
|
|
||||||
switch (avctx->pix_fmt) {
|
switch (avctx->pix_fmt) {
|
||||||
|
case AV_PIX_FMT_GBRP10BE:
|
||||||
|
case AV_PIX_FMT_GBRP10LE:
|
||||||
|
case AV_PIX_FMT_GBRP12BE:
|
||||||
|
case AV_PIX_FMT_GBRP12LE:
|
||||||
case AV_PIX_FMT_RGB24:
|
case AV_PIX_FMT_RGB24:
|
||||||
break;
|
case AV_PIX_FMT_RGBA64BE:
|
||||||
|
case AV_PIX_FMT_RGBA64LE:
|
||||||
case AV_PIX_FMT_RGBA:
|
case AV_PIX_FMT_RGBA:
|
||||||
s->descriptor = 51; /* RGBA */
|
|
||||||
break;
|
break;
|
||||||
case AV_PIX_FMT_RGB48LE:
|
case AV_PIX_FMT_RGB48LE:
|
||||||
s->big_endian = 0;
|
|
||||||
case AV_PIX_FMT_RGB48BE:
|
case AV_PIX_FMT_RGB48BE:
|
||||||
s->bits_per_component = avctx->bits_per_raw_sample ? avctx->bits_per_raw_sample : 16;
|
if (avctx->bits_per_raw_sample)
|
||||||
break;
|
s->bits_per_component = avctx->bits_per_raw_sample;
|
||||||
case AV_PIX_FMT_RGBA64LE:
|
|
||||||
s->big_endian = 0;
|
|
||||||
case AV_PIX_FMT_RGBA64BE:
|
|
||||||
s->descriptor = 51;
|
|
||||||
s->bits_per_component = 16;
|
|
||||||
break;
|
|
||||||
case AV_PIX_FMT_GBRP10LE:
|
|
||||||
s->big_endian = 0;
|
|
||||||
case AV_PIX_FMT_GBRP10BE:
|
|
||||||
s->bits_per_component = 10;
|
|
||||||
s->planar = 1;
|
|
||||||
break;
|
|
||||||
case AV_PIX_FMT_GBRP12LE:
|
|
||||||
s->big_endian = 0;
|
|
||||||
case AV_PIX_FMT_GBRP12BE:
|
|
||||||
s->bits_per_component = 12;
|
|
||||||
s->planar = 1;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
av_log(avctx, AV_LOG_INFO, "unsupported pixel format\n");
|
av_log(avctx, AV_LOG_INFO, "unsupported pixel format\n");
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
d2f0b4e854fda2d3b3bee84cef80593c *./tests/data/images/dpx/02.dpx
|
4c8880d5835ffb5fe37c1ed8c8d404de *./tests/data/images/dpx/02.dpx
|
||||||
./tests/data/images/dpx/%02d.dpx CRC=0x6da01946
|
./tests/data/images/dpx/%02d.dpx CRC=0x6da01946
|
||||||
305792 ./tests/data/images/dpx/02.dpx
|
305792 ./tests/data/images/dpx/02.dpx
|
||||||
075963c3c08978b6a20555ba09161434 *./tests/data/images/dpx/02.dpx
|
075963c3c08978b6a20555ba09161434 *./tests/data/images/dpx/02.dpx
|
||||||
|
Loading…
Reference in New Issue
Block a user