History

avfilter/vf_scale: use the inputs color range when its set and its not overridden

Michael Niedermayer committed 13 years ago

Commit 5156d481 parent a7e45cf1 file · +6 −0Browse files

Unified · Split

libavfilter/vf_scale.c+6−0
@@ -392,6 +392,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) · 391 unmodified lines
392392 AVFrame *out;
393393 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
394394 char buf[32];
395+ int in_range;
395396
396397 if( in->width != link->w
397398 || in->height != link->h
@@ -429,9 +430,12 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) · 31 unmodified lines
429430 if(scale->output_is_pal)
430431 avpriv_set_systematic_pal2((uint32_t*)out->data[1], outlink->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : outlink->format);
431432
433+ in_range = av_frame_get_color_range(in);
434+
432435 if ( scale->in_color_matrix
433436 || scale->out_color_matrix
434437 || scale-> in_range != AVCOL_RANGE_UNSPECIFIED
438+ || in_range != AVCOL_RANGE_UNSPECIFIED
435439 || scale->out_range != AVCOL_RANGE_UNSPECIFIED) {
436440 int in_full, out_full, brightness, contrast, saturation;
437441 const int *inv_table, *table;
@@ -447,6 +451,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) · 9 unmodified lines
447451
448452 if (scale-> in_range != AVCOL_RANGE_UNSPECIFIED)
449453 in_full = (scale-> in_range == AVCOL_RANGE_JPEG);
454+ else if (in_range != AVCOL_RANGE_UNSPECIFIED)
455+ in_full = (in_range == AVCOL_RANGE_JPEG);
450456 if (scale->out_range != AVCOL_RANGE_UNSPECIFIED)
451457 out_full = (scale->out_range == AVCOL_RANGE_JPEG);
452458

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t