comparison imgconvert.c @ 1282:8988af3ae1e8 libavcodec

Warning and compatibility fixes.
author mellum
date Sat, 24 May 2003 18:48:30 +0000
parents 5d2376294fbf
children cfc80b3a4ada
comparison
equal deleted inserted replaced
1281:37176fafe11e 1282:8988af3ae1e8
745 745
746 #define C_CCIR_TO_JPEG(y)\ 746 #define C_CCIR_TO_JPEG(y)\
747 cm[(((y) - 128) * FIX(127.0/112.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS] 747 cm[(((y) - 128) * FIX(127.0/112.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS]
748 748
749 /* NOTE: the clamp is really necessary! */ 749 /* NOTE: the clamp is really necessary! */
750 #define C_JPEG_TO_CCIR(y)\ 750 static inline int C_JPEG_TO_CCIR(int y) {
751 ({\ 751 y = (((y - 128) * FIX(112.0/127.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS);
752 int __y;\ 752 if (y < 16)
753 __y = ((((y) - 128) * FIX(112.0/127.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS);\ 753 y = 16;
754 if (__y < 16)\ 754 return y;
755 __y = 16;\ 755 }
756 __y;\ 756
757 })
758 757
759 #define RGB_TO_Y(r, g, b) \ 758 #define RGB_TO_Y(r, g, b) \
760 ((FIX(0.29900) * (r) + FIX(0.58700) * (g) + \ 759 ((FIX(0.29900) * (r) + FIX(0.58700) * (g) + \
761 FIX(0.11400) * (b) + ONE_HALF) >> SCALEBITS) 760 FIX(0.11400) * (b) + ONE_HALF) >> SCALEBITS)
762 761
1606 { 1605 {
1607 unsigned int size; 1606 unsigned int size;
1608 void *ptr; 1607 void *ptr;
1609 1608
1610 size = avpicture_get_size(pix_fmt, width, height); 1609 size = avpicture_get_size(pix_fmt, width, height);
1611 if (size < 0)
1612 goto fail;
1613 ptr = av_malloc(size); 1610 ptr = av_malloc(size);
1614 if (!ptr) 1611 if (!ptr)
1615 goto fail; 1612 goto fail;
1616 avpicture_fill(picture, ptr, pix_fmt, width, height); 1613 avpicture_fill(picture, ptr, pix_fmt, width, height);
1617 return 0; 1614 return 0;