You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avfilter/vf_scale: use the inputs color range when its set and its not overridden
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -392,6 +392,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
|
|||||||
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 in_range;
|
||||||
|
|
||||||
if( in->width != link->w
|
if( in->width != link->w
|
||||||
|| in->height != link->h
|
|| in->height != link->h
|
||||||
@@ -429,9 +430,12 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
|
|||||||
if(scale->output_is_pal)
|
if(scale->output_is_pal)
|
||||||
avpriv_set_systematic_pal2((uint32_t*)out->data[1], outlink->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : outlink->format);
|
avpriv_set_systematic_pal2((uint32_t*)out->data[1], outlink->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : outlink->format);
|
||||||
|
|
||||||
|
in_range = av_frame_get_color_range(in);
|
||||||
|
|
||||||
if ( scale->in_color_matrix
|
if ( scale->in_color_matrix
|
||||||
|| scale->out_color_matrix
|
|| scale->out_color_matrix
|
||||||
|| scale-> in_range != AVCOL_RANGE_UNSPECIFIED
|
|| scale-> in_range != AVCOL_RANGE_UNSPECIFIED
|
||||||
|
|| in_range != AVCOL_RANGE_UNSPECIFIED
|
||||||
|| scale->out_range != AVCOL_RANGE_UNSPECIFIED) {
|
|| scale->out_range != AVCOL_RANGE_UNSPECIFIED) {
|
||||||
int in_full, out_full, brightness, contrast, saturation;
|
int in_full, out_full, brightness, contrast, saturation;
|
||||||
const int *inv_table, *table;
|
const int *inv_table, *table;
|
||||||
@@ -447,6 +451,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
|
|||||||
|
|
||||||
if (scale-> in_range != AVCOL_RANGE_UNSPECIFIED)
|
if (scale-> in_range != AVCOL_RANGE_UNSPECIFIED)
|
||||||
in_full = (scale-> in_range == AVCOL_RANGE_JPEG);
|
in_full = (scale-> in_range == AVCOL_RANGE_JPEG);
|
||||||
|
else if (in_range != AVCOL_RANGE_UNSPECIFIED)
|
||||||
|
in_full = (in_range == AVCOL_RANGE_JPEG);
|
||||||
if (scale->out_range != AVCOL_RANGE_UNSPECIFIED)
|
if (scale->out_range != AVCOL_RANGE_UNSPECIFIED)
|
||||||
out_full = (scale->out_range == AVCOL_RANGE_JPEG);
|
out_full = (scale->out_range == AVCOL_RANGE_JPEG);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user