[FFmpeg-devel] [PATCH] avcodec: add a native BBC Dirac VC-2 HQ encoder
Kieran Kunhya
kierank at obe.tv
Fri Jan 15 00:55:57 CET 2016
> +static av_always_inline void coeff_quantize_encode(PutBitContext *pb, qcoef coeff,
> + int qfactor, int qoffset)
> +{
> + uint16_t acoef;
> + int sign = coeff < 0;
FFSIGN
> + coeff -= sign;
> + coeff ^= -sign;
> + coeff <<= 2;
> + coeff = (coeff - qoffset)/qfactor;
> + acoef = abs(coeff);
> + put_dirac_ue_uint(pb, acoef);
> + if (acoef)
> + put_bits(pb, 1, sign);
> +}
Might be faster to write a signed function, dunno
> +static av_always_inline void coeff_quantize_get(qcoef coeff, int qfactor, int qoffset,
> + uint8_t *len, uint32_t *eval)
> +{
> + uint16_t acoef;
> + int sign = coeff < 0;
same
> + coeff -= sign;
> + coeff ^= -sign;
> + coeff <<= 2;
> + coeff = (coeff - qoffset)/qfactor;
> + acoef = abs(coeff);
> + get_dirac_ue_uint(acoef, len, eval);
> + if (acoef) {
> + *eval = (*eval << 1) | sign;
> + *len += 1;
> + }
> +}
same
> + if (avctx->pix_fmt != AV_PIX_FMT_YUV422P10 ||
> + avctx->width != 1920 || avctx->height != 1080) {
> + if (avctx->strict_std_compliance <= FF_COMPLIANCE_EXPERIMENTAL) {
> + s->strict_compliance = 0;
> + av_log(avctx, AV_LOG_WARNING, "Disabling strict compliance\n");
> + } else {
> + av_log(avctx, AV_LOG_ERROR, "Pixel formats other than yuv422p10le "
> + "and sizes other than 1920x1080 are not within the standard, but are "
> + "still decodable by most decoders, add -strict -2 to enable support.\n");
> + return AVERROR_UNKNOWN;
> + }
Should obviously implement the other resolutions allowed.
Kieran
More information about the ffmpeg-devel
mailing list