diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-01-28 16:54:26 +0000 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-01-28 16:57:04 +0000 |
commit | 5b0d4c247a3c3ba8a8ece70b31354121645c8320 (patch) | |
tree | 9fe83a0d04bff7be533c99a6774c3ecfd529e50c /libavcodec/huffyuvenc.c | |
parent | 0e3e3656d31a7e1e595ccb5ca3acfc76a23d785e (diff) | |
parent | 96c373c7704aeb1cc1d2c275fbb5d71777665589 (diff) | |
download | ffmpeg-5b0d4c247a3c3ba8a8ece70b31354121645c8320.tar.gz |
Merge commit '96c373c7704aeb1cc1d2c275fbb5d71777665589'
* commit '96c373c7704aeb1cc1d2c275fbb5d71777665589':
lavc: Move context_model to codec private options
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavcodec/huffyuvenc.c')
-rw-r--r-- | libavcodec/huffyuvenc.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index e080cd90bb..febb71f089 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -28,6 +28,8 @@ * huffyuv encoder */ +#include "libavutil/opt.h" + #include "avcodec.h" #include "huffyuv.h" #include "huffman.h" @@ -237,6 +239,12 @@ FF_DISABLE_DEPRECATION_WARNINGS avctx->coded_frame->key_frame = 1; FF_ENABLE_DEPRECATION_WARNINGS #endif +#if FF_API_PRIVATE_OPT +FF_DISABLE_DEPRECATION_WARNINGS + if (avctx->context_model == 1) + s->context = avctx->context_model; +FF_ENABLE_DEPRECATION_WARNINGS +#endif s->bps = desc->comp[0].depth; s->yuv = !(desc->flags & AV_PIX_FMT_FLAG_RGB) && desc->nb_components >= 2; @@ -315,15 +323,14 @@ FF_ENABLE_DEPRECATION_WARNINGS s->decorrelate = s->bitstream_bpp >= 24 && !s->yuv && !(desc->flags & AV_PIX_FMT_FLAG_PLANAR); s->predictor = avctx->prediction_method; s->interlaced = avctx->flags & AV_CODEC_FLAG_INTERLACED_ME ? 1 : 0; - if (avctx->context_model == 1) { - s->context = avctx->context_model; + if (s->context) { if (s->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2)) { av_log(avctx, AV_LOG_ERROR, "context=1 is not compatible with " "2 pass huffyuv encoding\n"); return AVERROR(EINVAL); } - }else s->context= 0; + } if (avctx->codec->id == AV_CODEC_ID_HUFFYUV) { if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) { @@ -332,7 +339,8 @@ FF_ENABLE_DEPRECATION_WARNINGS "vcodec=ffvhuff or format=422p\n"); return AVERROR(EINVAL); } - if (avctx->context_model) { +#if FF_API_PRIVATE_OPT + if (s->context) { av_log(avctx, AV_LOG_ERROR, "Error: per-frame huffman tables are not supported " "by huffyuv; use vcodec=ffvhuff\n"); @@ -344,6 +352,7 @@ FF_ENABLE_DEPRECATION_WARNINGS "by huffyuv; use vcodec=ffvhuff\n"); return AVERROR(EINVAL); } +#endif if (s->interlaced != ( s->height > 288 )) av_log(avctx, AV_LOG_INFO, "using huffyuv 2.2.0 or newer interlacing flag\n"); @@ -1043,24 +1052,36 @@ static av_cold int encode_end(AVCodecContext *avctx) return 0; } -static const AVOption options[] = { - { "non_deterministic", "Allow multithreading for e.g. context=1 at the expense of determinism", - offsetof(HYuvContext, non_determ), AV_OPT_TYPE_BOOL, { .i64 = 1 }, - 0, 1, AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, +#define OFFSET(x) offsetof(HYuvContext, x) +#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM + +#define COMMON_OPTIONS \ + { "non_deterministic", "Allow multithreading for e.g. context=1 at the expense of determinism", \ + OFFSET(non_determ), AV_OPT_TYPE_BOOL, { .i64 = 1 }, \ + 0, 1, VE }, \ + +static const AVOption normal_options[] = { + COMMON_OPTIONS + { NULL }, +}; + +static const AVOption ff_options[] = { + COMMON_OPTIONS + { "context", "Set per-frame huffman tables", OFFSET(context), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, { NULL }, }; static const AVClass normal_class = { .class_name = "huffyuv", .item_name = av_default_item_name, - .option = options, + .option = normal_options, .version = LIBAVUTIL_VERSION_INT, }; static const AVClass ff_class = { .class_name = "ffvhuff", .item_name = av_default_item_name, - .option = options, + .option = ff_options, .version = LIBAVUTIL_VERSION_INT, }; |