[FFmpeg-devel] avcodec/proresaw_enc : improvment (vendor and color properties, 4444Xq)

Martin Vignali martin.vignali at gmail.com
Mon Nov 26 17:19:20 EET 2018


> > +
> > +    switch (pict->colorspace) {
> > +    case AVCOL_SPC_BT709:
> > +    case AVCOL_SPC_UNSPECIFIED:
> > +    case AVCOL_SPC_SMPTE170M:
> > +    case AVCOL_SPC_BT2020_NCL:
> > +        colorspace = pict->colorspace;
> > +        break;
> > +    default:
> > +        av_log(avctx, AV_LOG_DEBUG,
> > +                "Frame colorspace %d are not supported in prores frame.
> Set prores frame value to unspecified\n", pict->colorspace);
> > +        break;
> > +    }
> > +    *buf++ = color_primaries;
> > +    *buf++ = color_trc;
> > +    *buf++ = colorspace;
>
> we maybe should write a generic function that takes a list of supported
> types
> and the undefined one and then does the check, debug print and all that
> that could be used in other encoders too.
> just an idea, that can be done later
>
> the patch
> LGTM
>
>
Don't know for others codecs, but this check can also probably be add when
setting AvFrame color properties in prores dec.

As a generic function, do you mean something like this :
(If yes, where do you think it's better to declare this func)
(untested, and not sure, what is the right log level for this (debug or
warning ?))
----------------
int ff_check_value(AVCodecContext *avctx, const char * val_name, int val,
                    int * array_valid_values, int nb_values, int
default_value) {
    int i;
    for (i = 0 ; i < nb_values ; i ++) {
        if (val == array_valid_values[i]){
            return val;
        }
    }

    /* val is not a valid value */
    av_log(avctx, AV_LOG_DEBUG,
           "%s %d are not supported. Set to default value : %d\n",
val_name, val, default_value);
    return default_value;
}
----------------

Martin


More information about the ffmpeg-devel mailing list