1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/av1_parser: add missing parsing for RGB pixel format signaling

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2020-06-19 10:56:20 -03:00
parent 634a44db5a
commit af6cddae1f

View File

@ -45,6 +45,10 @@ static const enum AVPixelFormat pix_fmts_12bit[2][2] = {
{ AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV420P12 }, { AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV420P12 },
}; };
static const enum AVPixelFormat pix_fmts_rgb[3] = {
AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12,
};
static int av1_parser_parse(AVCodecParserContext *ctx, static int av1_parser_parse(AVCodecParserContext *ctx,
AVCodecContext *avctx, AVCodecContext *avctx,
const uint8_t **out_data, int *out_size, const uint8_t **out_data, int *out_size,
@ -161,6 +165,12 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
} }
av_assert2(ctx->format != AV_PIX_FMT_NONE); av_assert2(ctx->format != AV_PIX_FMT_NONE);
if (!color->subsampling_x && !color->subsampling_y &&
color->matrix_coefficients == AVCOL_SPC_RGB &&
color->color_primaries == AVCOL_PRI_BT709 &&
color->transfer_characteristics == AVCOL_TRC_IEC61966_2_1)
ctx->format = pix_fmts_rgb[color->high_bitdepth + color->twelve_bit];
avctx->profile = seq->seq_profile; avctx->profile = seq->seq_profile;
avctx->level = seq->seq_level_idx[0]; avctx->level = seq->seq_level_idx[0];