[FFmpeg-devel] [PATCH v3] avformat/mxfdec: Read video range from PictureDescriptor
Tomas Härdin
tjoppen at acc.umu.se
Wed Aug 12 16:59:41 EEST 2020
ons 2020-08-12 klockan 13:43 +0100 skrev Harry Mallon:
> @@ -2492,6 +2504,18 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
> }
> if (descriptor->aspect_ratio.num && descriptor->aspect_ratio.den)
> st->display_aspect_ratio = descriptor->aspect_ratio;
> + if (descriptor->component_depth &&
> + descriptor->black_ref_level == 0 &&
> + descriptor->white_ref_level == ((1<<descriptor->component_depth) - 1) &&
> + descriptor->color_range == ((1<<descriptor->component_depth) - 1)) {
> + st->codecpar->color_range = AVCOL_RANGE_JPEG;
> + }
> + else if (descriptor->component_depth >= 8 &&
> + descriptor->black_ref_level == (1 <<(descriptor->component_depth - 4)) &&
> + descriptor->white_ref_level == (235<<(descriptor->component_depth - 8)) &&
> + descriptor->color_range == ((14<<(descriptor->component_depth - 4)) + 1)) {
> + st->codecpar->color_range = AVCOL_RANGE_MPEG;
> + }
Put a warning here in case levels are set but neither of these two ifs
are true, perhaps using avpriv_request_sample(). I can imagine there's
encoders that put off-by-one values in here. I'd like to see such files
first though before we widen these if clauses, so we can put the
samples in FATE.
I'm testing the previous patch. Will push that one once FATE passes.
/Tomas
More information about the ffmpeg-devel
mailing list