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
183 { 0.5, 0, -0.5 },183 { 0.5, 0, -0.5 },
184};184};
185 185
186static 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 * All constants explained in e.g. https://linuxtv.org/downloads/v4l-dvb-apis/ch02s06.html194 * All constants explained in e.g. https://linuxtv.org/downloads/v4l-dvb-apis/ch02s06.html
188 * The older ones (bt470bg/m) are also explained in their respective ITU docs195 * 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 [AVCOL_SPC_BT709] = { 0.2126, 0.7152, 0.0722 },203 [AVCOL_SPC_BT709] = { 0.2126, 0.7152, 0.0722 },
197 [AVCOL_SPC_SMPTE240M] = { 0.212, 0.701, 0.087 },204 [AVCOL_SPC_SMPTE240M] = { 0.212, 0.701, 0.087 },
198 [AVCOL_SPC_YCOCG] = { 0.25, 0.5, 0.25 },205 [AVCOL_SPC_YCOCG] = { 0.25, 0.5, 0.25 },
206 [AVCOL_SPC_RGB] = { 1, 1, 1 },
199 [AVCOL_SPC_BT2020_NCL] = { 0.2627, 0.6780, 0.0593 },207 [AVCOL_SPC_BT2020_NCL] = { 0.2627, 0.6780, 0.0593 },
200 [AVCOL_SPC_BT2020_CL] = { 0.2627, 0.6780, 0.0593 },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 if (coeffs->cr == 0.25 && coeffs->cg == 0.5 && coeffs->cb == 0.25) {230 if (coeffs->cr == 0.25 && coeffs->cg == 0.5 && coeffs->cb == 0.25) {
223 memcpy(rgb2yuv, ycgco_matrix, sizeof(double) * 9);231 memcpy(rgb2yuv, ycgco_matrix, sizeof(double) * 9);
224 return;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 rgb2yuv[0][0] = coeffs->cr;238 rgb2yuv[0][0] = coeffs->cr;
@@ -1074,6 +1085,7 @@ static const AVOption colorspace_options[] = { · 846 unmodified lines
1074 ENUM("smpte170m", AVCOL_SPC_SMPTE170M, "csp"),1085 ENUM("smpte170m", AVCOL_SPC_SMPTE170M, "csp"),
1075 ENUM("smpte240m", AVCOL_SPC_SMPTE240M, "csp"),1086 ENUM("smpte240m", AVCOL_SPC_SMPTE240M, "csp"),
1076 ENUM("ycgco", AVCOL_SPC_YCGCO, "csp"),1087 ENUM("ycgco", AVCOL_SPC_YCGCO, "csp"),
1088 ENUM("gbr", AVCOL_SPC_RGB, "csp"),
1077 ENUM("bt2020ncl", AVCOL_SPC_BT2020_NCL, "csp"),1089 ENUM("bt2020ncl", AVCOL_SPC_BT2020_NCL, "csp"),
1078 1090
1079 { "range", "Output color range",1091 { "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