changeset 6526:561de0125a61

yvu9 and if09 support
author alex
date Sun, 23 Jun 2002 16:01:35 +0000
parents 0a7be46617d8
children 1baa35e06053
files codec-cfg.c dll_init.c xacodec.c
diffstat 3 files changed, 49 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/codec-cfg.c	Sun Jun 23 15:15:31 2002 +0000
+++ b/codec-cfg.c	Sun Jun 23 16:01:35 2002 +0000
@@ -119,6 +119,7 @@
 		{"I420",  IMGFMT_I420},
 		{"IYUV",  IMGFMT_IYUV},
 		{"YVU9",  IMGFMT_YVU9},
+		{"IF09",  IMGFMT_IF09},
 
 		{"YUY2",  IMGFMT_YUY2},
 		{"UYVY",  IMGFMT_UYVY},
--- a/dll_init.c	Sun Jun 23 15:15:31 2002 +0000
+++ b/dll_init.c	Sun Jun 23 16:01:35 2002 +0000
@@ -55,7 +55,7 @@
     sh_audio->o_wf.cbSize=0;
 
     if(verbose) {
-#if 0
+#if 1
 	printf("Input format:\n");
 	    printf("  wFormatTag %d\n", in_fmt->wFormatTag);
 	    printf("  nChannels %d\n", in_fmt->nChannels);
@@ -75,6 +75,7 @@
 #else
 	printf("Input format:\n");
 	print_wave_header(in_fmt);
+	print_wave_header(sh_audio->wf);
 	printf("Output fmt:\n");
 	print_wave_header(&sh_audio->o_wf);
 	printf("\n");
@@ -314,6 +315,11 @@
       sh_video->o_bih.biBitCount=12;
       yuv=1;
       break;
+  case IMGFMT_YVU9:
+  case IMGFMT_IF09:
+      sh_video->o_bih.biBitCount=9;
+      yuv=1;
+      break;
 
 /* packed format */
   case IMGFMT_YUY2:
--- a/xacodec.c	Sun Jun 23 15:15:31 2002 +0000
+++ b/xacodec.c	Sun Jun 23 16:01:35 2002 +0000
@@ -281,41 +281,22 @@
 
     switch(out_format)
     {
-/*	case IMGFMT_RGB8:
-	    codec_hdr.depth = 8;
-	    break;
-	case IMGFMT_RGB15:
-	    codec_hdr.depth = 15;
-	    break;
-	case IMGFMT_RGB16:
-	    codec_hdr.depth = 16;
-	    break;
-	case IMGFMT_RGB24:
-	    codec_hdr.depth = 24;
-	    break;
-	case IMGFMT_RGB32:
-	    codec_hdr.depth = 32;
-	    break;
-	case IMGFMT_BGR8:
-	    codec_hdr.depth = 8;
-	    break;
-	case IMGFMT_BGR15:
-	    codec_hdr.depth = 15;
-	    break;
-	case IMGFMT_BGR16:
-	    codec_hdr.depth = 16;
-	    break;
-	case IMGFMT_BGR24:
-	    codec_hdr.depth = 24;
-	    break;
-	case IMGFMT_BGR32:
-	    codec_hdr.depth = 32;
-	    break;*/
 	case IMGFMT_IYUV:
 	case IMGFMT_I420:
 	case IMGFMT_YV12:
 	    codec_hdr.depth = 12;
 	    break;
+	case IMGFMT_YVU9:
+	    if (vidinfo->bih->biCompression == mmioFOURCC('I','V','3','2') ||
+		vidinfo->bih->biCompression == mmioFOURCC('i','v','3','2') ||
+		vidinfo->bih->biCompression == mmioFOURCC('I','V','3','1') ||
+		vidinfo->bih->biCompression == mmioFOURCC('i','v','3','2'))
+	    {
+		mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: not supporting YVU9 output with Indeo3\n");
+		return(0);
+	    }
+	    codec_hdr.depth = 9;
+	    break;
 	default:
 	    mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: not supported image out format (%s)\n",
 		vo_format_name(out_format));
@@ -392,16 +373,22 @@
 
     image->planes[0]=image->mem;
     image->stride[0]=image->width;
-    image->stride[1]=image->stride[2]=image->width/2;
     switch(image->out_fmt){
     case IMGFMT_YV12:
 	image->planes[2]=image->planes[0]+image->width*image->height;
 	image->planes[1]=image->planes[2]+image->width*image->height/4;
+	image->stride[1]=image->stride[2]=image->width/2;
 	break;
     case IMGFMT_I420:
     case IMGFMT_IYUV:
 	image->planes[1]=image->planes[0]+image->width*image->height;
 	image->planes[2]=image->planes[1]+image->width*image->height/4;
+	image->stride[1]=image->stride[2]=image->width/2;
+	break;
+    case IMGFMT_YVU9:
+	image->planes[2]=image->planes[0]+image->width*image->height;
+	image->planes[1]=image->planes[2]+(image->width>>2)*(image->height>>2);
+	image->stride[1]=image->stride[2]=image->width/4;
 	break;
     }
 
@@ -641,7 +628,7 @@
 YUVBufs jpg_YUVBufs;
 YUVTabs def_yuv_tabs;
 
-/* -------------- YUV 4x4 1x1 1x1  [Indeo 3,4,5] ------------------ */
+/* -------------- YUV 4x4 1x1 1x1  (4:1:0 aka YVU9) [Indeo 3,4,5] ------------------ */
 
 void XA_YUV1611_Convert(unsigned char *image_p, unsigned int imagex, unsigned int imagey,
     unsigned int i_x, unsigned int i_y, YUVBufs *yuv, YUVTabs *yuv_tabs,
@@ -665,6 +652,27 @@
 	yuv->Ybuf,yuv->Ubuf,yuv->Vbuf,yuv->the_buf,yuv->the_buf_size,
 	yuv->y_w,yuv->y_h,yuv->uv_w,yuv->uv_h);
 
+    if(image->out_fmt == IMGFMT_YVU9 && !yuv_tabs->YUV_Y_tab)
+    {
+	if(i_x==image->width && i_y==image->height){
+	    image->planes[0]=yuv->Ybuf;
+	    image->planes[1]=yuv->Ubuf;
+	    image->planes[2]=yuv->Vbuf;
+	    image->stride[0]=i_x; // yuv->y_w
+	    image->stride[1]=image->stride[2]=i_x/4; // yuv->uv_w
+	} else {
+	    int y;
+	    for(y=0;y<i_y;y++)
+		memcpy(image->planes[0]+y*image->stride[0],yuv->Ybuf+y*i_x,i_x);
+	    i_x>>=2; i_y>>=2;
+	    for(y=0;y<i_y;y++){
+		memcpy(image->planes[1]+y*image->stride[1],yuv->Ubuf+y*i_x,i_x);
+		memcpy(image->planes[2]+y*image->stride[2],yuv->Vbuf+y*i_x,i_x);
+	    }
+	}
+	return;
+    }
+
     // copy Y plane:
     if(yuv_tabs->YUV_Y_tab){     // dirty hack to detect iv32:
 	for(y=0;y<imagey*imagex;y++)
@@ -707,7 +715,7 @@
     return((void *)XA_YUV1611_Convert);
 }
 
-/* -------------- YUV 4x1 1x1 1x1 (4:1:1 ?) [CYUV] ------------------ */
+/* -------------- YUV 4x1 1x1 1x1 (4:1:1 but interleaved) [CYUV] ------------------ */
 
 void XA_YUV411111_Convert(unsigned char *image, unsigned int imagex, unsigned int imagey,
     unsigned int i_x, unsigned int i_y, YUVBufs *yuv_bufs, YUVTabs *yuv_tabs,
@@ -740,8 +748,6 @@
 	yuv->Ybuf,yuv->Ubuf,yuv->Vbuf,yuv->the_buf,yuv->the_buf_size,
 	yuv->y_w,yuv->y_h,yuv->uv_w,yuv->uv_h);
 
-#warning "FIXME! Decoder doesn't supports Vivo/2.00 :("
-
 if(i_x==image->width && i_y==image->height){
 //    printf("Direct render!!!\n");
     image->planes[0]=yuv->Ybuf;