[FFmpeg-devel] [PATCH v5 1/2] avformat/mxfdec: Read video range from CDCIEssenceDescriptor

Tomas Härdin tjoppen at acc.umu.se
Mon Aug 24 11:29:03 EEST 2020


tor 2020-08-20 klockan 14:58 +0100 skrev Harry Mallon:
> * Capture black_ref, white_ref and color_range and recognise
>   full and narrow range.
> 
> Signed-off-by: Harry Mallon <harry.mallon at codex.online>
> ---
>  libavformat/mxfdec.c           | 37 ++++++++++++++++++++++++++++++++++
>  tests/ref/fate/mxf-probe-dnxhd |  2 +-
>  tests/ref/fate/mxf-probe-dv25  |  2 +-
>  3 files changed, 39 insertions(+), 2 deletions(-)
> 
> [...]
> +static enum AVColorRange mxf_get_color_range(MXFContext *mxf, MXFDescriptor *descriptor)
> +{
> +    if (descriptor->black_ref_level || descriptor->white_ref_level || descriptor->color_range) {
> +        /* CDCI range metadata */
> +        if (!descriptor->component_depth)
> +            return AVCOL_RANGE_UNSPECIFIED;
> +        if (descriptor->black_ref_level == 0 &&
> +            descriptor->white_ref_level == ((1<<descriptor->component_depth) - 1) &&
> +            (descriptor->color_range    == (1<<descriptor->component_depth) ||
> +             descriptor->color_range    == ((1<<descriptor->component_depth) - 1)))
> +            return AVCOL_RANGE_JPEG;
> +        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))
> +            return AVCOL_RANGE_MPEG;
> +        avpriv_request_sample(mxf->fc, "Unrecognized CDCI color range (color diff range %d, b %d, w %d, depth %d)",
> +                              descriptor->color_range, descriptor->black_ref_level,
> +                              descriptor->white_ref_level, descriptor->component_depth);
> +    }

Looks OK. Sorry about the late reply. I'll push tomorrow if there isn't
more feedback

/Tomas



More information about the ffmpeg-devel mailing list