mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
swscale: Pass through chroma positions in sws_getCachedContext
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
4bc0dbfc9f
commit
18982f084c
@ -1960,6 +1960,8 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW,
|
|||||||
{
|
{
|
||||||
static const double default_param[2] = { SWS_PARAM_DEFAULT,
|
static const double default_param[2] = { SWS_PARAM_DEFAULT,
|
||||||
SWS_PARAM_DEFAULT };
|
SWS_PARAM_DEFAULT };
|
||||||
|
int64_t src_h_chr_pos = -513, dst_h_chr_pos = -513,
|
||||||
|
src_v_chr_pos = -513, dst_v_chr_pos = -513;
|
||||||
|
|
||||||
if (!param)
|
if (!param)
|
||||||
param = default_param;
|
param = default_param;
|
||||||
@ -1974,6 +1976,11 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW,
|
|||||||
context->flags != flags ||
|
context->flags != flags ||
|
||||||
context->param[0] != param[0] ||
|
context->param[0] != param[0] ||
|
||||||
context->param[1] != param[1])) {
|
context->param[1] != param[1])) {
|
||||||
|
|
||||||
|
av_opt_get_int(context, "src_h_chr_pos", 0, &src_h_chr_pos);
|
||||||
|
av_opt_get_int(context, "src_v_chr_pos", 0, &src_v_chr_pos);
|
||||||
|
av_opt_get_int(context, "dst_h_chr_pos", 0, &dst_h_chr_pos);
|
||||||
|
av_opt_get_int(context, "dst_v_chr_pos", 0, &dst_v_chr_pos);
|
||||||
sws_freeContext(context);
|
sws_freeContext(context);
|
||||||
context = NULL;
|
context = NULL;
|
||||||
}
|
}
|
||||||
@ -1990,6 +1997,12 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW,
|
|||||||
context->flags = flags;
|
context->flags = flags;
|
||||||
context->param[0] = param[0];
|
context->param[0] = param[0];
|
||||||
context->param[1] = param[1];
|
context->param[1] = param[1];
|
||||||
|
|
||||||
|
av_opt_set_int(context, "src_h_chr_pos", src_h_chr_pos, 0);
|
||||||
|
av_opt_set_int(context, "src_v_chr_pos", src_v_chr_pos, 0);
|
||||||
|
av_opt_set_int(context, "dst_h_chr_pos", dst_h_chr_pos, 0);
|
||||||
|
av_opt_set_int(context, "dst_v_chr_pos", dst_v_chr_pos, 0);
|
||||||
|
|
||||||
if (sws_init_context(context, srcFilter, dstFilter) < 0) {
|
if (sws_init_context(context, srcFilter, dstFilter) < 0) {
|
||||||
sws_freeContext(context);
|
sws_freeContext(context);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user