- Timestamp:
- 02/21/10 23:59:26 (2 years ago)
- Parents:
- 66e0a72e52b6c9076ab19cebe52ae0ada6898d4a
- Children:
- 26852f5d3ef287c9672aba17dc5f0bfa3f9a2396
- git-committer:
- Robin Gareus <rgareus@priroda.local> / 2010-02-22T00:59:26Z+0100
- Files:
-
- 1 modified
-
oggzcap/src/videoout/encoder_example.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
oggzcap/src/videoout/encoder_example.c
r66e0a72 r6e49c34 86 86 cr_base += dst->uv_stride; 87 87 } 88 #else // RGBA -> 420 88 #else // RGBA -> 420 89 // TODO: offset ! & strides 89 90 90 91 #define _CR ((bptr[(4*i)+2])&0xff) … … 92 93 #define _CB ((bptr[(4*i)+0])&0xff) 93 94 95 #define _CRX ( ( ((bptr[(4*i)+2])&0xff) + ((bptr[(4*(i+1))+2])&0xff) + ((bptr[(4*(i+1+width))+2])&0xff) + ((bptr[(4*(i+1+width))+2])&0xff) )>>2) 96 #define _CGX ( ( ((bptr[(4*i)+1])&0xff) + ((bptr[(4*(i+1))+1])&0xff) + ((bptr[(4*(i+1+width))+1])&0xff) + ((bptr[(4*(i+1+width))+1])&0xff) )>>2) 97 #define _CBX ( ( ((bptr[(4*i)+0])&0xff) + ((bptr[(4*(i+1))+0])&0xff) + ((bptr[(4*(i+1+width))+0])&0xff) + ((bptr[(4*(i+1+width))+0])&0xff) )>>2) 98 94 99 uint8_t *bptr = (uint8_t*) b_2vuy; 95 100 int i; int c=0; 96 101 for (i=0;i<width*height;i++) { 97 double Y = (0.2 57 * _CR) + (0.504 * _CG) + (0.098 * _CB) + 16;102 double Y = (0.299 * _CR) + (0.587 * _CG) + (0.114 * _CB); 98 103 if (Y<0) dst->y[i]=0; 99 104 else if (Y>255) dst->y[i]=255; 100 105 else dst->y[i]=(uint8_t) floor(Y+.5); 101 106 #if 1 102 if (i%2==0 && ((i/width)%2)==0) { // TODO average 4 pixels103 double V = (0. 439 * _CR) - (0.368 * _CG) - (0.071 * _CB) + 128;104 double U = -(0.1 48 * _CR) - (0.291 * _CG) + (0.439 * _CB) + 128;107 if (i%2==0 && ((i/width)%2)==0) { 108 double V = (0.500 * _CRX) - (0.419 * _CGX) - (0.081 * _CBX) + 128; 109 double U = -(0.169 * _CRX) - (0.331 * _CGX) + (0.500 * _CBX) + 128; 105 110 106 111 if (U<0) dst->u[c]=0;
