History

vf_colorspace: Add support for gbr color space

Vittorio Giovara committed 9 years ago

Commit d9909b11 parent 18bca251 file · +12 −0Browse files

Unified · Split

libavfilter/vf_colorspace.c+12−0
@@ -183,6 +183,13 @@ static const double ycgco_matrix[3][3] = · 182 unmodified lines
183183 { 0.5, 0, -0.5 },
184184 };
185185
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+
186193 /*
187194 * All constants explained in e.g. https://linuxtv.org/downloads/v4l-dvb-apis/ch02s06.html
188195 * 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
196203 [AVCOL_SPC_BT709] = { 0.2126, 0.7152, 0.0722 },
197204 [AVCOL_SPC_SMPTE240M] = { 0.212, 0.701, 0.087 },
198205 [AVCOL_SPC_YCOCG] = { 0.25, 0.5, 0.25 },
206+ [AVCOL_SPC_RGB] = { 1, 1, 1 },
199207 [AVCOL_SPC_BT2020_NCL] = { 0.2627, 0.6780, 0.0593 },
200208 [AVCOL_SPC_BT2020_CL] = { 0.2627, 0.6780, 0.0593 },
201209 };
@@ -222,6 +230,9 @@ static void fill_rgb2yuv_table(const struct LumaCoefficients *coeffs, · 20 unmodified lines
222230 if (coeffs->cr == 0.25 && coeffs->cg == 0.5 && coeffs->cb == 0.25) {
223231 memcpy(rgb2yuv, ycgco_matrix, sizeof(double) * 9);
224232 return;
233+ } else if (coeffs->cr == 1 && coeffs->cg == 1 && coeffs->cb == 1) {
234+ memcpy(rgb2yuv, gbr_matrix, sizeof(double) * 9);
235+ return;
225236 }
226237
227238 rgb2yuv[0][0] = coeffs->cr;
@@ -1074,6 +1085,7 @@ static const AVOption colorspace_options[] = { · 846 unmodified lines
10741085 ENUM("smpte170m", AVCOL_SPC_SMPTE170M, "csp"),
10751086 ENUM("smpte240m", AVCOL_SPC_SMPTE240M, "csp"),
10761087 ENUM("ycgco", AVCOL_SPC_YCGCO, "csp"),
1088+ ENUM("gbr", AVCOL_SPC_RGB, "csp"),
10771089 ENUM("bt2020ncl", AVCOL_SPC_BT2020_NCL, "csp"),
10781090
10791091 { "range", "Output color range",

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