aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/colorspace.h
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2018-05-02 13:10:10 +0200
committerPaul B Mahol <onemda@gmail.com>2018-05-03 21:43:57 +0200
commitf43fd68f28079c49e9237894a294968d841babc7 (patch)
tree57500147d680b2d5f6b77bf7a25310eda7d2a002 /libavutil/colorspace.h
parent177133a0f4b41b3c98b9cbc7f8f45755412c537b (diff)
downloadffmpeg-f43fd68f28079c49e9237894a294968d841babc7.tar.gz
avfilter/drawutils: add support for full range
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavutil/colorspace.h')
-rw-r--r--libavutil/colorspace.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavutil/colorspace.h b/libavutil/colorspace.h
index b6dba2c95f..d0be8cb99a 100644
--- a/libavutil/colorspace.h
+++ b/libavutil/colorspace.h
@@ -107,4 +107,16 @@ static inline int C_JPEG_TO_CCIR(int y) {
(((FIX(0.50000*224.0/255.0) * r1 - FIX(0.41869*224.0/255.0) * g1 - \
FIX(0.08131*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
+#define RGB_TO_Y_JPEG(r, g, b) \
+(FFMIN((FIX(0.29900) * (r) + FIX(0.58700) * (g) + \
+ FIX(0.11400) * (b) + (ONE_HALF)) >> SCALEBITS, 255))
+
+#define RGB_TO_U_JPEG(r1, g1, b1)\
+(((- FIX(0.16874) * r1 - FIX(0.33126) * g1 + \
+ FIX(0.50000) * b1 + (ONE_HALF) - 1) >> (SCALEBITS)) + 128)
+
+#define RGB_TO_V_JPEG(r1, g1, b1)\
+(((FIX(0.50000) * r1 - FIX(0.41869) * g1 - \
+ FIX(0.08131) * b1 + (ONE_HALF) - 1) >> (SCALEBITS)) + 128)
+
#endif /* AVUTIL_COLORSPACE_H */