SAGE GSL-YUV support.

This commit is contained in:
xmatela
2008-03-04 19:22:15 +00:00
parent 3ea601c202
commit 366d3f07ed
3 changed files with 26 additions and 4 deletions

View File

@@ -49,7 +49,6 @@ struct state_sdl {
int *_0080;
int *_00ff;
//FIXME mplayeri pouzivaji jednu hodnotu typu uint64_t
//Cb = U, Cr = V
int *_YUV_Coef;
#define RED_v "0*16" //+ 1.596
@@ -402,7 +401,11 @@ static void* display_thread_sage(void *arg)
if (bitdepth == 10) {
line1 = s->buffers[s->image_display];
#ifdef SAGE_GLSL_YUV
line2 = s->outBuffer;
#else
line2 = s->yuvBuffer;
#endif
for(i=0; i<1080; i+=2) {
#ifdef HAVE_MACOSX
@@ -415,14 +418,27 @@ static void* display_thread_sage(void *arg)
line1 += 5120;
line2 += 2*3840;
}
#ifndef SAGE_GLSL_YUV
yuv2rgba(s->yuvBuffer, s->outBuffer);
#endif
}
else {
#ifdef SAGE_GLSL_YUV
line1 = s->buffers[s->image_display];
line2 = s->outBuffer;
for(i=0; i<1080; i+=2){
memcpy(line2, line1, HD_WIDTH*2);
memcpy(line2+HD_WIDTH*2, line1+HD_WIDTH*2*540, HD_WIDTH*2);
line1 += HD_WIDTH*2;
line2 += HD_WIDTH*2*2;
}
#else
yuv2rgba(s->buffers[s->image_display], s->outBuffer);
#endif
}
// swapBytes(s->outBuffer, HD_WIDTH*HD_HEIGHT*2);
// int i = open("/tmp/testcard_image.rgba_c", O_WRONLY|O_CREAT, 0644);
// write(i,s->buffers[s->image_display], HD_WIDTH*HD_HEIGHT*2);
// int i = open("/tmp/testcard_image.yuv", O_WRONLY|O_CREAT, 0644);
// write(i,s->yuvBuffer, HD_WIDTH*HD_HEIGHT*2);
// close(i);
sage_swapBuffer();
s->outBuffer = sage_getBuffer();

View File

@@ -24,8 +24,11 @@ void initSage(int appID, int nodeID)
renderImageMap.top = 1.0;
sailCfg.imageMap = renderImageMap;
//sailCfg.pixFmt = PIXFMT_YUV;
#ifdef SAGE_GLSL_YUV
sailCfg.pixFmt = PIXFMT_YUV;
#else
sailCfg.pixFmt = PIXFMT_8888_INV;
#endif
//sailCfg.rowOrd = BOTTOM_TO_TOP;
sailCfg.rowOrd = TOP_TO_BOTTOM;
sailCfg.master = true;

View File

@@ -1,6 +1,9 @@
#ifndef _SAGE_WRAPPER
#define _SAGE_WRAPPER
//switching between dircet sage YUV support and yuv2rgba conversion in ug
#define SAGE_GLSL_YUV 1
// SAGE headers
#ifdef __cplusplus
extern "C" void initSage(int appID, int nodeID);