]> git.sesse.net Git - mlt/blobdiff - src/framework/mlt_frame.h
Cleanup existing native color space conversions.
[mlt] / src / framework / mlt_frame.h
index db668e97fbc5be38543681ae4dcc8ba1156b3345..a03bdd6c95d4921342d138463a894106a9205b4d 100644 (file)
@@ -131,31 +131,10 @@ extern int64_t mlt_sample_calculator_to_now( float fps, int frequency, int64_t p
 extern const char * mlt_image_format_name( mlt_image_format format );
 extern const char * mlt_audio_format_name( mlt_audio_format format );
 
-/** This macro scales rgb into the yuv gamut - y is scaled by 219/255 and uv by 224/255. */
-#define RGB2YUV(r, g, b, y, u, v)\
+/** This macro scales RGB into the YUV gamut - y is scaled by 219/255 and uv by 224/255. */
+#define RGB2YUV_601_SCALED(r, g, b, y, u, v)\
   y = ((263*r + 516*g + 100*b) >> 10) + 16;\
-  u = ((-152*r - 298*g + 450*b) >> 10) + 128;\
+  u = ((-152*r - 300*g + 450*b) >> 10) + 128;\
   v = ((450*r - 377*g - 73*b) >> 10) + 128;
 
-/** This macro assumes the user has already scaled their rgb down into the broadcast limits. **/
-#define RGB2YUV_UNSCALED(r, g, b, y, u, v)\
-  y = (299*r + 587*g + 114*b) >> 10;\
-  u = ((-169*r - 331*g + 500*b) >> 10) + 128;\
-  v = ((500*r - 419*g - 81*b) >> 10) + 128;\
-  y = y < 16 ? 16 : y;\
-  u = u < 16 ? 16 : u;\
-  v = v < 16 ? 16 : v;\
-  y = y > 235 ? 235 : y;\
-  u = u > 240 ? 240 : u;\
-  v = v > 240 ? 240 : v
-
-/** This macro converts a YUV value to the RGB color space. */
-#define YUV2RGB( y, u, v, r, g, b ) \
-  r = ((1192 * ( y - 16 ) + 1634 * ( v - 128 ) ) >> 10 ); \
-  g = ((1192 * ( y - 16 ) - 832 * ( v - 128 ) - 400 * ( u - 128 ) ) >> 10 ); \
-  b = ((1192 * ( y - 16 ) + 2066 * ( u - 128 ) ) >> 10 ); \
-  r = r < 0 ? 0 : r > 255 ? 255 : r; \
-  g = g < 0 ? 0 : g > 255 ? 255 : g; \
-  b = b < 0 ? 0 : b > 255 ? 255 : b;
-
 #endif