History

swscale/utils: fix changing src/dst range after initializing the context

Michael Niedermayer committed 12 years ago

Commit 4959a4f1 parent fa988851 file · +6 −0Browse files

Unified · Split

libswscale/utils.c+6−0
@@ -983,6 +983,7 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], · 982 unmodified lines
983983 {
984984 const AVPixFmtDescriptor *desc_dst;
985985 const AVPixFmtDescriptor *desc_src;
986+ int need_reinit = 0;
986987 memmove(c->srcColorspaceTable, inv_table, sizeof(int) * 4);
987988 memmove(c->dstColorspaceTable, table, sizeof(int) * 4);
988989
@@ -998,9 +999,14 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], · 9 unmodified lines
998999 c->brightness = brightness;
9991000 c->contrast = contrast;
10001001 c->saturation = saturation;
1002+ if (c->srcRange != srcRange || c->dstRange != dstRange)
1003+ need_reinit = 1;
10011004 c->srcRange = srcRange;
10021005 c->dstRange = dstRange;
10031006
1007+ if (need_reinit && c->srcBpc == 8)
1008+ ff_sws_init_range_convert(c);
1009+
10041010 if ((isYUV(c->dstFormat) || isGray(c->dstFormat)) && (isYUV(c->srcFormat) || isGray(c->srcFormat)))
10051011 return -1;
10061012

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