Unified · Split
| @@ -183,6 +183,13 @@ static const double ycgco_matrix[3][3] = · 182 unmodified lines | ||
| 183 | 183 | { 0.5, 0, -0.5 }, |
| 184 | 184 | }; |
| 185 | 185 | |
| 186 | +static const double gbr_matrix[3][3] = | |
| 187 | +{ | |
| 188 | + { 0, 1, 0 }, | |
| 189 | + { 0, -0.5, 0.5 }, | |
| 190 | + { 0.5, -0.5, 0 }, | |
| 191 | +}; | |
| 192 | + | |
| 186 | 193 | /* |
| 187 | 194 | * All constants explained in e.g. https://linuxtv.org/downloads/v4l-dvb-apis/ch02s06.html |
| 188 | 195 | * The older ones (bt470bg/m) are also explained in their respective ITU docs |
| @@ -196,6 +203,7 @@ static const struct LumaCoefficients luma_coefficients[AVCOL_SPC_NB] = { · 7 unmodified lines | ||
| 196 | 203 | [AVCOL_SPC_BT709] = { 0.2126, 0.7152, 0.0722 }, |
| 197 | 204 | [AVCOL_SPC_SMPTE240M] = { 0.212, 0.701, 0.087 }, |
| 198 | 205 | [AVCOL_SPC_YCOCG] = { 0.25, 0.5, 0.25 }, |
| 206 | + [AVCOL_SPC_RGB] = { 1, 1, 1 }, | |
| 199 | 207 | [AVCOL_SPC_BT2020_NCL] = { 0.2627, 0.6780, 0.0593 }, |
| 200 | 208 | [AVCOL_SPC_BT2020_CL] = { 0.2627, 0.6780, 0.0593 }, |
| 201 | 209 | }; |
| @@ -222,6 +230,9 @@ static void fill_rgb2yuv_table(const struct LumaCoefficients *coeffs, · 20 unmodified lines | ||
| 222 | 230 | if (coeffs->cr == 0.25 && coeffs->cg == 0.5 && coeffs->cb == 0.25) { |
| 223 | 231 | memcpy(rgb2yuv, ycgco_matrix, sizeof(double) * 9); |
| 224 | 232 | return; |
| 233 | + } else if (coeffs->cr == 1 && coeffs->cg == 1 && coeffs->cb == 1) { | |
| 234 | + memcpy(rgb2yuv, gbr_matrix, sizeof(double) * 9); | |
| 235 | + return; | |
| 225 | 236 | } |
| 226 | 237 | |
| 227 | 238 | rgb2yuv[0][0] = coeffs->cr; |
| @@ -1074,6 +1085,7 @@ static const AVOption colorspace_options[] = { · 846 unmodified lines | ||
| 1074 | 1085 | ENUM("smpte170m", AVCOL_SPC_SMPTE170M, "csp"), |
| 1075 | 1086 | ENUM("smpte240m", AVCOL_SPC_SMPTE240M, "csp"), |
| 1076 | 1087 | ENUM("ycgco", AVCOL_SPC_YCGCO, "csp"), |
| 1088 | + ENUM("gbr", AVCOL_SPC_RGB, "csp"), | |
| 1077 | 1089 | ENUM("bt2020ncl", AVCOL_SPC_BT2020_NCL, "csp"), |
| 1078 | 1090 | |
| 1079 | 1091 | { "range", "Output color range", |