comparison postproc/swscale.c @ 6863:713182435a76

planar yuv 444 422 411 support
author michael
date Thu, 01 Aug 2002 12:39:08 +0000
parents 5c4beb993674
children c6aa14b47d03
comparison
equal deleted inserted replaced
6862:fe7095e0adec 6863:713182435a76
101 #else 101 #else
102 #define PI 3.14159265358979323846 102 #define PI 3.14159265358979323846
103 #endif 103 #endif
104 104
105 //FIXME replace this with something faster 105 //FIXME replace this with something faster
106 #define isPlanarYUV(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_I420 || (x)==IMGFMT_YVU9) 106 #define isPlanarYUV(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_I420 || (x)==IMGFMT_YVU9 \
107 || (x)==IMGFMT_444P || (x)==IMGFMT_422P || (x)==IMGFMT_411P)
107 #define isYUV(x) ((x)==IMGFMT_YUY2 || isPlanarYUV(x)) 108 #define isYUV(x) ((x)==IMGFMT_YUY2 || isPlanarYUV(x))
108 #define isGray(x) ((x)==IMGFMT_Y800) 109 #define isGray(x) ((x)==IMGFMT_Y800)
109 #define isRGB(x) (((x)&IMGFMT_RGB_MASK)==IMGFMT_RGB) 110 #define isRGB(x) (((x)&IMGFMT_RGB_MASK)==IMGFMT_RGB)
110 #define isBGR(x) (((x)&IMGFMT_BGR_MASK)==IMGFMT_BGR) 111 #define isBGR(x) (((x)&IMGFMT_BGR_MASK)==IMGFMT_BGR)
111 #define isSupportedIn(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_I420 || (x)==IMGFMT_YUY2 \ 112 #define isSupportedIn(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_I420 || (x)==IMGFMT_YUY2 \
112 || (x)==IMGFMT_BGR32|| (x)==IMGFMT_BGR24|| (x)==IMGFMT_BGR16|| (x)==IMGFMT_BGR15\ 113 || (x)==IMGFMT_BGR32|| (x)==IMGFMT_BGR24|| (x)==IMGFMT_BGR16|| (x)==IMGFMT_BGR15\
113 || (x)==IMGFMT_RGB32|| (x)==IMGFMT_RGB24\ 114 || (x)==IMGFMT_RGB32|| (x)==IMGFMT_RGB24\
114 || (x)==IMGFMT_Y800 || (x)==IMGFMT_YVU9) 115 || (x)==IMGFMT_Y800 || (x)==IMGFMT_YVU9\
116 || (x)==IMGFMT_444P || (x)==IMGFMT_422P || (x)==IMGFMT_411P)
115 #define isSupportedOut(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_I420 \ 117 #define isSupportedOut(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_I420 \
118 || (x)==IMGFMT_444P || (x)==IMGFMT_422P || (x)==IMGFMT_411P\
116 || isRGB(x) || isBGR(x)\ 119 || isRGB(x) || isBGR(x)\
117 || (x)==IMGFMT_Y800 || (x)==IMGFMT_YVU9) 120 || (x)==IMGFMT_Y800 || (x)==IMGFMT_YVU9)
118 #define isPacked(x) ((x)==IMGFMT_YUY2 || isRGB(x) || isBGR(x)) 121 #define isPacked(x) ((x)==IMGFMT_YUY2 || isRGB(x) || isBGR(x))
119 122
120 #define RGB2YUV_SHIFT 16 123 #define RGB2YUV_SHIFT 16
1755 1758
1756 /** 1759 /**
1757 * bring pointers in YUV order instead of YVU 1760 * bring pointers in YUV order instead of YVU
1758 */ 1761 */
1759 static inline void orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]){ 1762 static inline void orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]){
1760 if(format == IMGFMT_YV12 || format == IMGFMT_YVU9){ 1763 if(format == IMGFMT_YV12 || format == IMGFMT_YVU9
1764 || format == IMGFMT_444P || format == IMGFMT_422P || format == IMGFMT_411P){
1761 sortedP[0]= p[0]; 1765 sortedP[0]= p[0];
1762 sortedP[1]= p[1]; 1766 sortedP[1]= p[1];
1763 sortedP[2]= p[2]; 1767 sortedP[2]= p[2];
1764 sortedStride[0]= stride[0]; 1768 sortedStride[0]= stride[0];
1765 sortedStride[1]= stride[1]; 1769 sortedStride[1]= stride[1];
1882 *v=1; 1886 *v=1;
1883 break; 1887 break;
1884 case IMGFMT_YVU9: 1888 case IMGFMT_YVU9:
1885 *h=2; 1889 *h=2;
1886 *v=2; 1890 *v=2;
1891 break;
1892 case IMGFMT_444P:
1893 *h=0;
1894 *v=0;
1895 break;
1896 case IMGFMT_422P:
1897 *h=1;
1898 *v=0;
1899 break;
1900 case IMGFMT_411P:
1901 *h=2;
1902 *v=0;
1887 break; 1903 break;
1888 default: 1904 default:
1889 *h=0; 1905 *h=0;
1890 *v=0; 1906 *v=0;
1891 break; 1907 break;