Commit 7c6e86c0 authored by Derek Buitenhuis's avatar Derek Buitenhuis

Merge commit '5764d381'

* commit '5764d381':
  lavc: Move chromaoffset to codec private options
Merged-by: 's avatarDerek Buitenhuis <derek.buitenhuis@gmail.com>
parents 13be46c0 5764d381
...@@ -2209,12 +2209,11 @@ typedef struct AVCodecContext { ...@@ -2209,12 +2209,11 @@ typedef struct AVCodecContext {
*/ */
int refs; int refs;
/** #if FF_API_PRIVATE_OPT
* chroma qp offset from luma /** @deprecated use encoder private options instead */
* - encoding: Set by user. attribute_deprecated
* - decoding: unused
*/
int chromaoffset; int chromaoffset;
#endif
#if FF_API_UNUSED_MEMBERS #if FF_API_UNUSED_MEMBERS
/** /**
......
...@@ -87,6 +87,7 @@ typedef struct X264Context { ...@@ -87,6 +87,7 @@ typedef struct X264Context {
int coder; int coder;
int a53_cc; int a53_cc;
int b_frame_strategy; int b_frame_strategy;
int chroma_offset;
char *x264_params; char *x264_params;
} X264Context; } X264Context;
...@@ -530,8 +531,16 @@ static av_cold int X264_init(AVCodecContext *avctx) ...@@ -530,8 +531,16 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor); x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor);
if (avctx->b_quant_factor > 0) if (avctx->b_quant_factor > 0)
x4->params.rc.f_pb_factor = avctx->b_quant_factor; x4->params.rc.f_pb_factor = avctx->b_quant_factor;
#if FF_API_PRIVATE_OPT
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->chromaoffset) if (avctx->chromaoffset)
x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset; x4->chroma_offset = avctx->chromaoffset;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (x4->chroma_offset)
x4->params.analyse.i_chroma_qp_offset = x4->chroma_offset;
if (avctx->gop_size >= 0) if (avctx->gop_size >= 0)
x4->params.i_keyint_max = avctx->gop_size; x4->params.i_keyint_max = avctx->gop_size;
...@@ -964,6 +973,7 @@ static const AVOption options[] = { ...@@ -964,6 +973,7 @@ static const AVOption options[] = {
{ "vlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "coder" }, { "vlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "coder" },
{ "ac", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "coder" }, { "ac", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "coder" },
{ "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 2, VE }, { "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 2, VE },
{ "chromaoffset", "QP difference between chroma and luma", OFFSET(chroma_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, VE },
{ "x264-params", "Override the x264 configuration using a :-separated list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { "x264-params", "Override the x264 configuration using a :-separated list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ NULL }, { NULL },
......
...@@ -57,6 +57,7 @@ typedef struct XavsContext { ...@@ -57,6 +57,7 @@ typedef struct XavsContext {
int mbtree; int mbtree;
int mixed_refs; int mixed_refs;
int b_frame_strategy; int b_frame_strategy;
int chroma_offset;
int64_t *pts_buffer; int64_t *pts_buffer;
int out_frame_count; int out_frame_count;
...@@ -377,7 +378,15 @@ FF_ENABLE_DEPRECATION_WARNINGS ...@@ -377,7 +378,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
/* what is the RC method we are now using? Default NO */ /* what is the RC method we are now using? Default NO */
x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor); x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor);
x4->params.rc.f_pb_factor = avctx->b_quant_factor; x4->params.rc.f_pb_factor = avctx->b_quant_factor;
x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset;
#if FF_API_PRIVATE_OPT
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->chromaoffset)
x4->chroma_offset = avctx->chromaoffset;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
x4->params.analyse.i_chroma_qp_offset = x4->chroma_offset;
x4->params.analyse.b_psnr = avctx->flags & AV_CODEC_FLAG_PSNR; x4->params.analyse.b_psnr = avctx->flags & AV_CODEC_FLAG_PSNR;
x4->params.i_log_level = XAVS_LOG_DEBUG; x4->params.i_log_level = XAVS_LOG_DEBUG;
...@@ -446,6 +455,7 @@ static const AVOption options[] = { ...@@ -446,6 +455,7 @@ static const AVOption options[] = {
{ "esa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_ESA }, INT_MIN, INT_MAX, VE, "motion-est" }, { "esa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_ESA }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "tesa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_TESA }, INT_MIN, INT_MAX, VE, "motion-est" }, { "tesa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_TESA }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, VE}, { "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, VE},
{ "chromaoffset", "QP difference between chroma and luma", OFFSET(chroma_offset), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE},
{ NULL }, { NULL },
}; };
......
...@@ -410,7 +410,9 @@ static const AVOption avcodec_options[] = { ...@@ -410,7 +410,9 @@ static const AVOption avcodec_options[] = {
#endif #endif
{"keyint_min", "minimum interval between IDR-frames", OFFSET(keyint_min), AV_OPT_TYPE_INT, {.i64 = 25 }, INT_MIN, INT_MAX, V|E}, {"keyint_min", "minimum interval between IDR-frames", OFFSET(keyint_min), AV_OPT_TYPE_INT, {.i64 = 25 }, INT_MIN, INT_MAX, V|E},
{"refs", "reference frames to consider for motion compensation", OFFSET(refs), AV_OPT_TYPE_INT, {.i64 = 1 }, INT_MIN, INT_MAX, V|E}, {"refs", "reference frames to consider for motion compensation", OFFSET(refs), AV_OPT_TYPE_INT, {.i64 = 1 }, INT_MIN, INT_MAX, V|E},
#if FF_API_PRIVATE_OPT
{"chromaoffset", "chroma QP offset from luma", OFFSET(chromaoffset), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, {"chromaoffset", "chroma QP offset from luma", OFFSET(chromaoffset), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
#endif
{"trellis", "rate-distortion optimal quantization", OFFSET(trellis), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E}, {"trellis", "rate-distortion optimal quantization", OFFSET(trellis), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
#if FF_API_UNUSED_MEMBERS #if FF_API_UNUSED_MEMBERS
{"sc_factor", "multiplied by qscale for each frame and added to scene_change_score", OFFSET(scenechange_factor), AV_OPT_TYPE_INT, {.i64 = 6 }, 0, INT_MAX, V|E}, {"sc_factor", "multiplied by qscale for each frame and added to scene_change_score", OFFSET(scenechange_factor), AV_OPT_TYPE_INT, {.i64 = 6 }, 0, INT_MAX, V|E},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment