|
|
@ -655,6 +655,7 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out) |
|
|
|
AVFrame *out; |
|
|
|
AVFrame *out; |
|
|
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); |
|
|
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); |
|
|
|
char buf[32]; |
|
|
|
char buf[32]; |
|
|
|
|
|
|
|
int ret; |
|
|
|
int in_range; |
|
|
|
int in_range; |
|
|
|
int frame_changed; |
|
|
|
int frame_changed; |
|
|
|
|
|
|
|
|
|
|
@ -669,7 +670,6 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out) |
|
|
|
in->sample_aspect_ratio.num != link->sample_aspect_ratio.num; |
|
|
|
in->sample_aspect_ratio.num != link->sample_aspect_ratio.num; |
|
|
|
|
|
|
|
|
|
|
|
if (scale->eval_mode == EVAL_MODE_FRAME || frame_changed) { |
|
|
|
if (scale->eval_mode == EVAL_MODE_FRAME || frame_changed) { |
|
|
|
int ret; |
|
|
|
|
|
|
|
unsigned vars_w[VARS_NB] = { 0 }, vars_h[VARS_NB] = { 0 }; |
|
|
|
unsigned vars_w[VARS_NB] = { 0 }, vars_h[VARS_NB] = { 0 }; |
|
|
|
|
|
|
|
|
|
|
|
av_expr_count_vars(scale->w_pexpr, vars_w, VARS_NB); |
|
|
|
av_expr_count_vars(scale->w_pexpr, vars_w, VARS_NB); |
|
|
@ -791,8 +791,9 @@ scale: |
|
|
|
INT_MAX); |
|
|
|
INT_MAX); |
|
|
|
|
|
|
|
|
|
|
|
if (scale->interlaced>0 || (scale->interlaced<0 && in->interlaced_frame)) { |
|
|
|
if (scale->interlaced>0 || (scale->interlaced<0 && in->interlaced_frame)) { |
|
|
|
scale_slice(scale, out, in, scale->isws[0], 0, (link->h+1)/2, 2, 0); |
|
|
|
ret = scale_slice(scale, out, in, scale->isws[0], 0, (link->h+1)/2, 2, 0); |
|
|
|
scale_slice(scale, out, in, scale->isws[1], 0, link->h /2, 2, 1); |
|
|
|
if (ret >= 0) |
|
|
|
|
|
|
|
ret = scale_slice(scale, out, in, scale->isws[1], 0, link->h /2, 2, 1); |
|
|
|
} else if (scale->nb_slices) { |
|
|
|
} else if (scale->nb_slices) { |
|
|
|
int i, slice_h, slice_start, slice_end = 0; |
|
|
|
int i, slice_h, slice_start, slice_end = 0; |
|
|
|
const int nb_slices = FFMIN(scale->nb_slices, link->h); |
|
|
|
const int nb_slices = FFMIN(scale->nb_slices, link->h); |
|
|
@ -800,14 +801,18 @@ scale: |
|
|
|
slice_start = slice_end; |
|
|
|
slice_start = slice_end; |
|
|
|
slice_end = (link->h * (i+1)) / nb_slices; |
|
|
|
slice_end = (link->h * (i+1)) / nb_slices; |
|
|
|
slice_h = slice_end - slice_start; |
|
|
|
slice_h = slice_end - slice_start; |
|
|
|
scale_slice(scale, out, in, scale->sws, slice_start, slice_h, 1, 0); |
|
|
|
ret = scale_slice(scale, out, in, scale->sws, slice_start, slice_h, 1, 0); |
|
|
|
|
|
|
|
if (ret < 0) |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
scale_slice(scale, out, in, scale->sws, 0, link->h, 1, 0); |
|
|
|
ret = scale_slice(scale, out, in, scale->sws, 0, link->h, 1, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
av_frame_free(&in); |
|
|
|
av_frame_free(&in); |
|
|
|
return 0; |
|
|
|
if (ret < 0) |
|
|
|
|
|
|
|
av_frame_free(frame_out); |
|
|
|
|
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int filter_frame(AVFilterLink *link, AVFrame *in) |
|
|
|
static int filter_frame(AVFilterLink *link, AVFrame *in) |
|
|
|