diff options
| -rw-r--r-- | Documentation/media/uapi/v4l/pixfmt-007.rst | 30 | ||||
| -rw-r--r-- | drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 14 |
2 files changed, 21 insertions, 23 deletions
diff --git a/Documentation/media/uapi/v4l/pixfmt-007.rst b/Documentation/media/uapi/v4l/pixfmt-007.rst index c45d8794e8eb..662302cfba8b 100644 --- a/Documentation/media/uapi/v4l/pixfmt-007.rst +++ b/Documentation/media/uapi/v4l/pixfmt-007.rst | |||
| @@ -97,11 +97,11 @@ the following ``V4L2_YCBCR_ENC_601`` encoding: | |||
| 97 | 97 | ||
| 98 | .. math:: | 98 | .. math:: |
| 99 | 99 | ||
| 100 | Y' = 0.299R' + 0.587G' + 0.114B' | 100 | Y' = 0.2990R' + 0.5870G' + 0.1140B' |
| 101 | 101 | ||
| 102 | Cb = -0.169R' - 0.331G' + 0.5B' | 102 | Cb = -0.1687R' - 0.3313G' + 0.5B' |
| 103 | 103 | ||
| 104 | Cr = 0.5R' - 0.419G' - 0.081B' | 104 | Cr = 0.5R' - 0.4187G' - 0.0813B' |
| 105 | 105 | ||
| 106 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | 106 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range |
| 107 | [-0.5…0.5]. This conversion to Y'CbCr is identical to the one defined in | 107 | [-0.5…0.5]. This conversion to Y'CbCr is identical to the one defined in |
| @@ -241,11 +241,11 @@ scaled and offset: | |||
| 241 | 241 | ||
| 242 | .. math:: | 242 | .. math:: |
| 243 | 243 | ||
| 244 | Y' = \frac{219}{256} * (0.299R' + 0.587G' + 0.114B') + \frac{16}{256} | 244 | Y' = \frac{219}{256} * (0.2990R' + 0.5870G' + 0.1140B') + \frac{16}{256} |
| 245 | 245 | ||
| 246 | Cb = \frac{224}{256} * (-0.169R' - 0.331G' + 0.5B') | 246 | Cb = \frac{224}{256} * (-0.1687R' - 0.3313G' + 0.5B') |
| 247 | 247 | ||
| 248 | Cr = \frac{224}{256} * (0.5R' - 0.419G' - 0.081B') | 248 | Cr = \frac{224}{256} * (0.5R' - 0.4187G' - 0.0813B') |
| 249 | 249 | ||
| 250 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | 250 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range |
| 251 | [-0.5…0.5]. The non-standard xvYCC 709 or xvYCC 601 encodings can be | 251 | [-0.5…0.5]. The non-standard xvYCC 709 or xvYCC 601 encodings can be |
| @@ -440,11 +440,11 @@ the following ``V4L2_YCBCR_ENC_601`` encoding: | |||
| 440 | 440 | ||
| 441 | .. math:: | 441 | .. math:: |
| 442 | 442 | ||
| 443 | Y' = 0.299R' + 0.587G' + 0.114B' | 443 | Y' = 0.2990R' + 0.5870G' + 0.1140B' |
| 444 | 444 | ||
| 445 | Cb = -0.169R' - 0.331G' + 0.5B' | 445 | Cb = -0.1687R' - 0.3313G' + 0.5B' |
| 446 | 446 | ||
| 447 | Cr = 0.5R' - 0.419G' - 0.081B' | 447 | Cr = 0.5R' - 0.4187G' - 0.0813B' |
| 448 | 448 | ||
| 449 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | 449 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range |
| 450 | [-0.5…0.5]. This transform is identical to one defined in SMPTE | 450 | [-0.5…0.5]. This transform is identical to one defined in SMPTE |
| @@ -842,11 +842,11 @@ the following ``V4L2_YCBCR_ENC_601`` encoding: | |||
| 842 | 842 | ||
| 843 | .. math:: | 843 | .. math:: |
| 844 | 844 | ||
| 845 | Y' = 0.299R' + 0.587G' + 0.114B' | 845 | Y' = 0.2990R' + 0.5870G' + 0.1140B' |
| 846 | 846 | ||
| 847 | Cb = -0.169R' - 0.331G' + 0.5B' | 847 | Cb = -0.1687R' - 0.3313G' + 0.5B' |
| 848 | 848 | ||
| 849 | Cr = 0.5R' - 0.419G' - 0.081B' | 849 | Cr = 0.5R' - 0.4187G' - 0.0813B' |
| 850 | 850 | ||
| 851 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | 851 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range |
| 852 | [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is | 852 | [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is |
| @@ -940,11 +940,11 @@ the following ``V4L2_YCBCR_ENC_601`` encoding: | |||
| 940 | 940 | ||
| 941 | .. math:: | 941 | .. math:: |
| 942 | 942 | ||
| 943 | Y' = 0.299R' + 0.587G' + 0.114B' | 943 | Y' = 0.2990R' + 0.5870G' + 0.1140B' |
| 944 | 944 | ||
| 945 | Cb = -0.169R' - 0.331G' + 0.5B' | 945 | Cb = -0.1687R' - 0.3313G' + 0.5B' |
| 946 | 946 | ||
| 947 | Cr = 0.5R' - 0.419G' - 0.081B' | 947 | Cr = 0.5R' - 0.4187G' - 0.0813B' |
| 948 | 948 | ||
| 949 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | 949 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range |
| 950 | [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is | 950 | [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is |
diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c index 3ec3cebe62b9..1684810cab83 100644 --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | |||
| @@ -504,14 +504,14 @@ static void color_to_ycbcr(struct tpg_data *tpg, int r, int g, int b, | |||
| 504 | #define COEFF(v, r) ((int)(0.5 + (v) * (r) * 256.0)) | 504 | #define COEFF(v, r) ((int)(0.5 + (v) * (r) * 256.0)) |
| 505 | 505 | ||
| 506 | static const int bt601[3][3] = { | 506 | static const int bt601[3][3] = { |
| 507 | { COEFF(0.299, 219), COEFF(0.587, 219), COEFF(0.114, 219) }, | 507 | { COEFF(0.299, 219), COEFF(0.587, 219), COEFF(0.114, 219) }, |
| 508 | { COEFF(-0.169, 224), COEFF(-0.331, 224), COEFF(0.5, 224) }, | 508 | { COEFF(-0.1687, 224), COEFF(-0.3313, 224), COEFF(0.5, 224) }, |
| 509 | { COEFF(0.5, 224), COEFF(-0.419, 224), COEFF(-0.081, 224) }, | 509 | { COEFF(0.5, 224), COEFF(-0.4187, 224), COEFF(-0.0813, 224) }, |
| 510 | }; | 510 | }; |
| 511 | static const int bt601_full[3][3] = { | 511 | static const int bt601_full[3][3] = { |
| 512 | { COEFF(0.299, 255), COEFF(0.587, 255), COEFF(0.114, 255) }, | 512 | { COEFF(0.299, 255), COEFF(0.587, 255), COEFF(0.114, 255) }, |
| 513 | { COEFF(-0.169, 255), COEFF(-0.331, 255), COEFF(0.5, 255) }, | 513 | { COEFF(-0.1687, 255), COEFF(-0.3313, 255), COEFF(0.5, 255) }, |
| 514 | { COEFF(0.5, 255), COEFF(-0.419, 255), COEFF(-0.081, 255) }, | 514 | { COEFF(0.5, 255), COEFF(-0.4187, 255), COEFF(-0.0813, 255) }, |
| 515 | }; | 515 | }; |
| 516 | static const int rec709[3][3] = { | 516 | static const int rec709[3][3] = { |
| 517 | { COEFF(0.2126, 219), COEFF(0.7152, 219), COEFF(0.0722, 219) }, | 517 | { COEFF(0.2126, 219), COEFF(0.7152, 219), COEFF(0.0722, 219) }, |
| @@ -558,7 +558,6 @@ static void color_to_ycbcr(struct tpg_data *tpg, int r, int g, int b, | |||
| 558 | 558 | ||
| 559 | switch (tpg->real_ycbcr_enc) { | 559 | switch (tpg->real_ycbcr_enc) { |
| 560 | case V4L2_YCBCR_ENC_601: | 560 | case V4L2_YCBCR_ENC_601: |
| 561 | case V4L2_YCBCR_ENC_SYCC: | ||
| 562 | rgb2ycbcr(full ? bt601_full : bt601, r, g, b, y_offset, y, cb, cr); | 561 | rgb2ycbcr(full ? bt601_full : bt601, r, g, b, y_offset, y, cb, cr); |
| 563 | break; | 562 | break; |
| 564 | case V4L2_YCBCR_ENC_XV601: | 563 | case V4L2_YCBCR_ENC_XV601: |
| @@ -674,7 +673,6 @@ static void ycbcr_to_color(struct tpg_data *tpg, int y, int cb, int cr, | |||
| 674 | 673 | ||
| 675 | switch (tpg->real_ycbcr_enc) { | 674 | switch (tpg->real_ycbcr_enc) { |
| 676 | case V4L2_YCBCR_ENC_601: | 675 | case V4L2_YCBCR_ENC_601: |
| 677 | case V4L2_YCBCR_ENC_SYCC: | ||
| 678 | ycbcr2rgb(full ? bt601_full : bt601, y, cb, cr, y_offset, r, g, b); | 676 | ycbcr2rgb(full ? bt601_full : bt601, y, cb, cr, y_offset, r, g, b); |
| 679 | break; | 677 | break; |
| 680 | case V4L2_YCBCR_ENC_XV601: | 678 | case V4L2_YCBCR_ENC_XV601: |
