comparison libswscale/swscale-example.c @ 29469:a5f2750d1ff1

swscale-example: Don't check for chroma planes in mono formats.
author ramiro
date Thu, 13 Aug 2009 18:39:39 +0000
parents 32ee4e7438ac
children c080f1f5c07e
comparison
equal deleted inserted replaced
29468:947a942221c4 29469:a5f2750d1ff1
35 #define isGray(x) ( \ 35 #define isGray(x) ( \
36 (x)==PIX_FMT_GRAY8 \ 36 (x)==PIX_FMT_GRAY8 \
37 || (x)==PIX_FMT_GRAY16BE \ 37 || (x)==PIX_FMT_GRAY16BE \
38 || (x)==PIX_FMT_GRAY16LE \ 38 || (x)==PIX_FMT_GRAY16LE \
39 ) 39 )
40 #define hasChroma(x) (!( \
41 isGray(x) \
42 || (x)==PIX_FMT_MONOBLACK \
43 || (x)==PIX_FMT_MONOWHITE \
44 ))
40 #define isALPHA(x) ( \ 45 #define isALPHA(x) ( \
41 (x)==PIX_FMT_BGR32 \ 46 (x)==PIX_FMT_BGR32 \
42 || (x)==PIX_FMT_BGR32_1 \ 47 || (x)==PIX_FMT_BGR32_1 \
43 || (x)==PIX_FMT_RGB32 \ 48 || (x)==PIX_FMT_RGB32 \
44 || (x)==PIX_FMT_RGB32_1 \ 49 || (x)==PIX_FMT_RGB32_1 \
137 sws_scale(srcContext, ref, refStride, 0, h , src, srcStride); 142 sws_scale(srcContext, ref, refStride, 0, h , src, srcStride);
138 sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride); 143 sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride);
139 sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride); 144 sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride);
140 145
141 ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h); 146 ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h);
142 if (!isGray(srcFormat) && !isGray(dstFormat)) { 147 if (hasChroma(srcFormat) && hasChroma(dstFormat)) {
143 //FIXME check that output is really gray 148 //FIXME check that output is really gray
144 ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1); 149 ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1);
145 ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1); 150 ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1);
146 } 151 }
147 if (isALPHA(srcFormat) && isALPHA(dstFormat)) 152 if (isALPHA(srcFormat) && isALPHA(dstFormat))