Unified · Split
| @@ -983,6 +983,7 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], · 982 unmodified lines | ||
| 983 | 983 | { |
| 984 | 984 | const AVPixFmtDescriptor *desc_dst; |
| 985 | 985 | const AVPixFmtDescriptor *desc_src; |
| 986 | + int need_reinit = 0; | |
| 986 | 987 | memmove(c->srcColorspaceTable, inv_table, sizeof(int) * 4); |
| 987 | 988 | memmove(c->dstColorspaceTable, table, sizeof(int) * 4); |
| 988 | 989 | |
| @@ -998,9 +999,14 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], · 9 unmodified lines | ||
| 998 | 999 | c->brightness = brightness; |
| 999 | 1000 | c->contrast = contrast; |
| 1000 | 1001 | c->saturation = saturation; |
| 1002 | + if (c->srcRange != srcRange || c->dstRange != dstRange) | |
| 1003 | + need_reinit = 1; | |
| 1001 | 1004 | c->srcRange = srcRange; |
| 1002 | 1005 | c->dstRange = dstRange; |
| 1003 | 1006 | |
| 1007 | + if (need_reinit && c->srcBpc == 8) | |
| 1008 | + ff_sws_init_range_convert(c); | |
| 1009 | + | |
| 1004 | 1010 | if ((isYUV(c->dstFormat) || isGray(c->dstFormat)) && (isYUV(c->srcFormat) || isGray(c->srcFormat))) |
| 1005 | 1011 | return -1; |
| 1006 | 1012 | |