Mercurial > mplayer.hg
annotate libmpcodecs/vd_qtvideo.c @ 10039:59c7b1abd9e6
Sync with HTML
author | lumag |
---|---|
date | Wed, 30 Apr 2003 21:41:57 +0000 |
parents | 241bba8f60e8 |
children | 81f8e4f97b38 |
rev | line source |
---|---|
8160 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 | |
4 #include "config.h" | |
5 | |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
6 #if defined(USE_QTX_CODECS) || defined(MACOSX) |
8160 | 7 |
8 #include "mp_msg.h" | |
9 #include "vd_internal.h" | |
10 | |
9405
a4444e7ee56a
real cygwin support by Sascha Sommer <saschasommer@freenet.de>
alex
parents:
8473
diff
changeset
|
11 #ifdef WIN32_LOADER |
8451 | 12 #include "ldt_keeper.h" |
13 #endif | |
14 | |
8160 | 15 static vd_info_t info = { |
16 "Quicktime Video decoder", | |
17 "qtvideo", | |
18 "A'rpi", | |
19 "Faust3", | |
20 "win32" | |
21 }; | |
22 | |
23 LIBVD_EXTERN(qtvideo) | |
24 | |
8282 | 25 #include "../bswap.h" |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
26 |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
27 #ifdef MACOSX |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
28 #include <QuickTime/ImageCodec.h> |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
29 #define dump_ImageDescription(x) |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
30 #else |
8270 | 31 #include "qtx/qtxsdk/components.h" |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
32 #endif |
8160 | 33 |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
34 #ifdef USE_QTX_CODECS |
8160 | 35 //#include "wine/windef.h" |
36 | |
37 HMODULE WINAPI LoadLibraryA(LPCSTR); | |
38 FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR); | |
39 int WINAPI FreeLibrary(HMODULE); | |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
40 #endif |
8160 | 41 |
42 //static ComponentDescription desc; // for FindNextComponent() | |
43 static ComponentInstance ci=NULL; // codec handle | |
44 //static CodecInfo cinfo; // for ImageCodecGetCodecInfo() | |
45 //Component prev=NULL; | |
46 //ComponentResult cres; // | |
47 static CodecCapabilities codeccap; // for decpar | |
48 static CodecDecompressParams decpar; // for ImageCodecPreDecompress() | |
49 //static ImageSubCodecDecompressCapabilities icap; // for ImageCodecInitialize() | |
50 static Rect OutBufferRect; //the dimensions of our GWorld | |
51 | |
52 static GWorldPtr OutBufferGWorld = NULL;//a GWorld is some kind of description for a drawing environment | |
53 static ImageDescriptionHandle framedescHandle; | |
54 //static HINSTANCE qtml_dll; | |
55 static HMODULE handler; | |
56 | |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
57 #ifdef USE_QTX_CODECS |
8160 | 58 static Component (*FindNextComponent)(Component prev,ComponentDescription* desc); |
59 static OSErr (*GetComponentInfo)(Component prev,ComponentDescription* desc,Handle h1,Handle h2,Handle h3); | |
60 static long (*CountComponents)(ComponentDescription* desc); | |
61 static OSErr (*InitializeQTML)(long flags); | |
62 static OSErr (*EnterMovies)(void); | |
63 static ComponentInstance (*OpenComponent)(Component c); | |
64 static ComponentResult (*ImageCodecInitialize)(ComponentInstance ci, | |
65 ImageSubCodecDecompressCapabilities * cap); | |
66 static ComponentResult (*ImageCodecBeginBand)(ComponentInstance ci, | |
67 CodecDecompressParams * params, | |
68 ImageSubCodecDecompressRecord * drp, | |
69 long flags); | |
70 static ComponentResult (*ImageCodecDrawBand)(ComponentInstance ci, | |
71 ImageSubCodecDecompressRecord * drp); | |
72 static ComponentResult (*ImageCodecEndBand)(ComponentInstance ci, | |
73 ImageSubCodecDecompressRecord * drp, | |
74 OSErr result, | |
75 long flags); | |
76 static ComponentResult (*ImageCodecGetCodecInfo)(ComponentInstance ci, | |
77 CodecInfo * info); | |
78 static ComponentResult (*ImageCodecPreDecompress)(ComponentInstance ci, | |
79 CodecDecompressParams * params); | |
80 static ComponentResult (*ImageCodecBandDecompress)(ComponentInstance ci, | |
81 CodecDecompressParams * params); | |
82 static PixMapHandle (*GetGWorldPixMap)(GWorldPtr offscreenGWorld); | |
83 static OSErr (*QTNewGWorldFromPtr)(GWorldPtr *gw, | |
84 OSType pixelFormat, | |
85 const Rect *boundsRect, | |
86 CTabHandle cTable, | |
87 /*GDHandle*/void* aGDevice, //unused anyway | |
88 GWorldFlags flags, | |
89 void *baseAddr, | |
90 long rowBytes); | |
91 static OSErr (*NewHandleClear)(Size byteCount); | |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
92 #endif |
8160 | 93 |
94 // to set/get/query special features/parameters | |
95 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
96 return CONTROL_UNKNOWN; | |
97 } | |
98 | |
99 static int codec_inited=0; | |
100 | |
101 // init driver | |
102 static int init(sh_video_t *sh){ | |
103 long result = 1; | |
104 ComponentResult cres; | |
105 ComponentDescription desc; | |
106 Component prev=NULL; | |
107 CodecInfo cinfo; // for ImageCodecGetCodecInfo() | |
108 ImageSubCodecDecompressCapabilities icap; // for ImageCodecInitialize() | |
109 | |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
110 #ifdef MACOSX |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
111 EnterMovies(); |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
112 #else |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
113 |
9405
a4444e7ee56a
real cygwin support by Sascha Sommer <saschasommer@freenet.de>
alex
parents:
8473
diff
changeset
|
114 #ifdef WIN32_LOADER |
8270 | 115 Setup_LDT_Keeper(); |
116 #endif | |
117 | |
8160 | 118 handler = LoadLibraryA("qtmlClient.dll"); |
119 | |
8451 | 120 InitializeQTML = (OSErr (*)(long))GetProcAddress(handler, "InitializeQTML"); |
121 EnterMovies = (OSErr (*)(void))GetProcAddress(handler, "EnterMovies"); | |
122 FindNextComponent = (Component (*)(Component,ComponentDescription*))GetProcAddress(handler, "FindNextComponent"); | |
123 CountComponents = (long (*)(ComponentDescription*))GetProcAddress(handler, "CountComponents"); | |
124 GetComponentInfo = (OSErr (*)(Component,ComponentDescription*,Handle,Handle,Handle))GetProcAddress(handler, "GetComponentInfo"); | |
125 OpenComponent = (ComponentInstance (*)(Component))GetProcAddress(handler, "OpenComponent"); | |
126 ImageCodecInitialize = (ComponentResult (*)(ComponentInstance,ImageSubCodecDecompressCapabilities *))GetProcAddress(handler, "ImageCodecInitialize"); | |
127 ImageCodecGetCodecInfo = (ComponentResult (*)(ComponentInstance,CodecInfo *))GetProcAddress(handler, "ImageCodecGetCodecInfo"); | |
128 ImageCodecBeginBand = (ComponentResult (*)(ComponentInstance,CodecDecompressParams *,ImageSubCodecDecompressRecord *,long))GetProcAddress(handler, "ImageCodecBeginBand"); | |
129 ImageCodecPreDecompress = (ComponentResult (*)(ComponentInstance,CodecDecompressParams *))GetProcAddress(handler, "ImageCodecPreDecompress"); | |
130 ImageCodecBandDecompress = (ComponentResult (*)(ComponentInstance,CodecDecompressParams *))GetProcAddress(handler, "ImageCodecBandDecompress"); | |
131 GetGWorldPixMap = (PixMapHandle (*)(GWorldPtr))GetProcAddress(handler, "GetGWorldPixMap"); | |
132 QTNewGWorldFromPtr = (OSErr(*)(GWorldPtr *,OSType,const Rect *,CTabHandle,void*,GWorldFlags,void *,long))GetProcAddress(handler, "QTNewGWorldFromPtr"); | |
133 NewHandleClear = (OSErr(*)(Size))GetProcAddress(handler, "NewHandleClear"); | |
8160 | 134 // = GetProcAddress(handler, ""); |
135 | |
136 if(!InitializeQTML || !EnterMovies || !FindNextComponent || !ImageCodecBandDecompress){ | |
137 printf("invalid qt DLL!\n"); | |
138 return 0; | |
139 } | |
140 | |
8162
98951b7331e1
no need to EnterMovies(), do minimal InitializeQTML only
arpi
parents:
8160
diff
changeset
|
141 result=InitializeQTML(6+16); |
98951b7331e1
no need to EnterMovies(), do minimal InitializeQTML only
arpi
parents:
8160
diff
changeset
|
142 // result=InitializeQTML(0); |
8160 | 143 printf("InitializeQTML returned %i\n",result); |
8162
98951b7331e1
no need to EnterMovies(), do minimal InitializeQTML only
arpi
parents:
8160
diff
changeset
|
144 // result=EnterMovies(); |
98951b7331e1
no need to EnterMovies(), do minimal InitializeQTML only
arpi
parents:
8160
diff
changeset
|
145 // printf("EnterMovies->%d\n",result); |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
146 #endif /* !MACOSX */ |
8160 | 147 |
8428 | 148 #if 0 |
149 memset(&desc,0,sizeof(desc)); | |
150 while((prev=FindNextComponent(prev,&desc))){ | |
151 ComponentDescription desc2; | |
152 unsigned char* c1=&desc2.componentType; | |
153 unsigned char* c2=&desc2.componentSubType; | |
154 memset(&desc2,0,sizeof(desc2)); | |
155 // printf("juhee %p (%p)\n",prev,&desc); | |
156 GetComponentInfo(prev,&desc2,NULL,NULL,NULL); | |
157 printf("DESC: %c%c%c%c/%c%c%c%c [0x%X/0x%X] 0x%X\n", | |
158 c1[3],c1[2],c1[1],c1[0], | |
159 c2[3],c2[2],c2[1],c2[0], | |
160 desc2.componentType,desc2.componentSubType, | |
161 desc2.componentFlags); | |
162 } | |
163 #endif | |
164 | |
165 | |
8160 | 166 memset(&desc,0,sizeof(desc)); |
167 desc.componentType= (((unsigned char)'i')<<24)| | |
168 (((unsigned char)'m')<<16)| | |
169 (((unsigned char)'d')<<8)| | |
170 (((unsigned char)'c')); | |
8282 | 171 #if 0 |
8160 | 172 desc.componentSubType= |
173 (((unsigned char)'S'<<24))| | |
174 (((unsigned char)'V')<<16)| | |
175 (((unsigned char)'Q')<<8)| | |
176 (((unsigned char)'3')); | |
8282 | 177 #else |
178 desc.componentSubType = bswap_32(sh->format); | |
179 #endif | |
8160 | 180 desc.componentManufacturer=0; |
181 desc.componentFlags=0; | |
182 desc.componentFlagsMask=0; | |
183 | |
184 printf("Count = %d\n",CountComponents(&desc)); | |
185 prev=FindNextComponent(NULL,&desc); | |
186 if(!prev){ | |
187 printf("Cannot find requested component\n"); | |
8282 | 188 return(0); |
8160 | 189 } |
190 printf("Found it! ID = 0x%X\n",prev); | |
191 | |
192 ci=OpenComponent(prev); | |
193 printf("ci=%p\n",ci); | |
194 | |
195 memset(&icap,0,sizeof(icap)); | |
196 cres=ImageCodecInitialize(ci,&icap); | |
197 printf("ImageCodecInitialize->%p size=%d (%d)\n",cres,icap.recordSize,icap.decompressRecordSize); | |
198 | |
199 memset(&cinfo,0,sizeof(cinfo)); | |
200 cres=ImageCodecGetCodecInfo(ci,&cinfo); | |
201 printf("Flags: compr: 0x%X decomp: 0x%X format: 0x%X\n", | |
202 cinfo.compressFlags, cinfo.decompressFlags, cinfo.formatFlags); | |
203 printf("Codec name: %.*s\n",((unsigned char*)&cinfo.typeName)[0], | |
204 ((unsigned char*)&cinfo.typeName)+1); | |
205 | |
206 //make a yuy2 gworld | |
207 OutBufferRect.top=0; | |
208 OutBufferRect.left=0; | |
209 OutBufferRect.right=sh->disp_w; | |
210 OutBufferRect.bottom=sh->disp_h; | |
211 | |
212 //Fill the imagedescription for our SVQ3 frame | |
213 //we can probably get this from Demuxer | |
214 #if 0 | |
215 framedescHandle=(ImageDescriptionHandle)NewHandleClear(sizeof(ImageDescription)+200); | |
216 printf("framedescHandle=%p *p=%p\n",framedescHandle,*framedescHandle); | |
217 { FILE* f=fopen("/root/.wine/fake_windows/IDesc","r"); | |
218 if(!f) printf("filenot found: IDesc\n"); | |
219 fread(*framedescHandle,sizeof(ImageDescription)+200,1,f); | |
220 fclose(f); | |
221 } | |
222 #else | |
8471 | 223 if(!sh->ImageDesc) sh->ImageDesc=(sh->bih+1); // hack for SVQ3-in-AVI |
8301 | 224 printf("ImageDescription size: %d\n",((ImageDescription*)(sh->ImageDesc))->idSize); |
225 framedescHandle=(ImageDescriptionHandle)NewHandleClear(((ImageDescription*)(sh->ImageDesc))->idSize); | |
226 memcpy(*framedescHandle,sh->ImageDesc,((ImageDescription*)(sh->ImageDesc))->idSize); | |
8471 | 227 dump_ImageDescription(*framedescHandle); |
8160 | 228 #endif |
229 //Find codecscomponent for video decompression | |
230 // result = FindCodec ('SVQ1',anyCodec,&compressor,&decompressor ); | |
231 // printf("FindCodec SVQ1 returned:%i compressor: 0x%X decompressor: 0x%X\n",result,compressor,decompressor); | |
232 | |
8282 | 233 sh->context = kYUVSPixelFormat; |
8301 | 234 #if 1 |
8282 | 235 { |
236 int imgfmt = sh->codec->outfmt[sh->outfmtidx]; | |
237 int qt_imgfmt; | |
238 switch(imgfmt) | |
239 { | |
240 case IMGFMT_YUY2: | |
241 qt_imgfmt = kYUVSPixelFormat; | |
242 break; | |
243 case IMGFMT_YVU9: | |
8301 | 244 qt_imgfmt = 0x73797639; //kYVU9PixelFormat; |
245 break; | |
246 case IMGFMT_YV12: | |
247 qt_imgfmt = 0x79343230; | |
8282 | 248 break; |
249 case IMGFMT_UYVY: | |
250 qt_imgfmt = kUYVY422PixelFormat; | |
251 break; | |
252 case IMGFMT_YVYU: | |
253 qt_imgfmt = kYVYU422PixelFormat; | |
254 imgfmt = IMGFMT_YUY2; | |
255 break; | |
256 case IMGFMT_RGB16: | |
257 qt_imgfmt = k16LE555PixelFormat; | |
258 break; | |
259 case IMGFMT_BGR24: | |
260 qt_imgfmt = k24BGRPixelFormat; | |
261 break; | |
262 case IMGFMT_BGR32: | |
263 qt_imgfmt = k32BGRAPixelFormat; | |
264 break; | |
265 case IMGFMT_RGB32: | |
266 qt_imgfmt = k32RGBAPixelFormat; | |
267 break; | |
268 default: | |
269 printf("Unknown requested csp\n"); | |
270 return(0); | |
271 } | |
272 printf("imgfmt: %s qt_imgfmt: %.4s\n", vo_format_name(imgfmt), &qt_imgfmt); | |
273 sh->context = qt_imgfmt; | |
274 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,imgfmt)) return 0; | |
275 } | |
276 #else | |
8160 | 277 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; |
8282 | 278 #endif |
8160 | 279 |
280 return 1; | |
281 } | |
282 | |
283 // uninit driver | |
284 static void uninit(sh_video_t *sh){ | |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
285 #ifdef MACOSX |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
286 ExitMovies(); |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
287 #endif |
8160 | 288 } |
289 | |
290 // decode a frame | |
291 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
292 long result = 1; | |
8321
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
293 int i; |
8160 | 294 mp_image_t* mpi; |
295 ComponentResult cres; | |
8473 | 296 |
297 if(len<=0) return NULL; // skipped frame | |
8160 | 298 |
299 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE, | |
300 sh->disp_w, sh->disp_h); | |
301 if(!mpi) return NULL; | |
302 | |
303 decpar.data = (char*)data; | |
304 decpar.bufferSize = len; | |
305 (**framedescHandle).dataSize=len; | |
306 | |
307 if(!codec_inited){ | |
308 result = QTNewGWorldFromPtr( | |
309 &OutBufferGWorld, | |
8282 | 310 // kYUVSPixelFormat, //pixel format of new GWorld == YUY2 |
311 sh->context, | |
8160 | 312 &OutBufferRect, //we should benchmark if yvu9 is faster for svq3, too |
313 0, | |
314 0, | |
315 0, | |
316 mpi->planes[0], | |
317 mpi->stride[0]); | |
8282 | 318 printf("NewGWorldFromPtr returned:%d\n",65536-(result&0xffff)); |
319 // if (65536-(result&0xFFFF) != 10000) | |
320 // return NULL; | |
8160 | 321 |
322 // printf("IDesc=%d\n",sizeof(ImageDescription)); | |
323 | |
324 decpar.imageDescription = framedescHandle; | |
325 decpar.startLine=0; | |
326 decpar.stopLine=(**framedescHandle).height; | |
327 decpar.frameNumber = 1; //1 | |
328 // decpar.conditionFlags=0xFFD; // first | |
329 // decpar.callerFlags=0x2001; // first | |
330 decpar.matrixFlags = 0; | |
331 decpar.matrixType = 0; | |
332 decpar.matrix = 0; | |
333 decpar.capabilities=&codeccap; | |
334 // decpar.accuracy = 0x1680000; //codecNormalQuality; | |
335 decpar.accuracy = codecNormalQuality; | |
8431 | 336 // decpar.port = OutBufferGWorld; |
8160 | 337 // decpar.preferredOffscreenPixelSize=17207; |
338 | |
339 // decpar.sequenceID=malloc(1000); | |
340 // memset(decpar.sequenceID,0,1000); | |
341 | |
342 // SrcRect.top=17207; | |
343 // SrcRect.left=0; | |
344 // SrcRect.right=0;//image_width; | |
345 // SrcRect.bottom=0;//image_height; | |
346 | |
347 // decpar.srcRect = SrcRect; | |
348 decpar.srcRect = OutBufferRect; | |
349 | |
350 decpar.transferMode = srcCopy; | |
351 decpar.dstPixMap = **GetGWorldPixMap( OutBufferGWorld);//destPixmap; | |
352 | |
353 cres=ImageCodecPreDecompress(ci,&decpar); | |
354 printf("ImageCodecPreDecompress cres=0x%X\n",cres); | |
8430 | 355 |
356 if(decpar.wantedDestinationPixelTypes) | |
357 { OSType *p=*(decpar.wantedDestinationPixelTypes); | |
358 if(p) while(*p){ | |
359 printf("supported csp: 0x%08X %.4s\n",*p,p); | |
360 ++p; | |
361 } | |
362 } | |
363 | |
8160 | 364 |
365 // decpar.conditionFlags=0x10FFF; // first | |
366 // decpar.preferredOffscreenPixelSize=17207; | |
367 | |
368 // decpar.conditionFlags=0x10FFD; // first | |
369 | |
370 // cres=ImageCodecPreDecompress(ci,&decpar); | |
371 // printf("ImageCodecPreDecompress cres=0x%X\n",cres); | |
372 | |
373 | |
374 codec_inited=1; | |
375 } | |
376 | |
377 #if 0 | |
378 if(decpar.frameNumber==124){ | |
379 decpar.frameNumber=1; | |
380 cres=ImageCodecPreDecompress(ci,&decpar); | |
381 printf("ImageCodecPreDecompress cres=0x%X\n",cres); | |
382 } | |
383 #endif | |
384 | |
385 cres=ImageCodecBandDecompress(ci,&decpar); | |
386 | |
387 ++decpar.frameNumber; | |
8321
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
388 |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
389 if(cres&0xFFFF){ |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
390 printf("ImageCodecBandDecompress cres=0x%X (-0x%X) %d\n",cres,-cres,cres); |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
391 return NULL; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
392 } |
8160 | 393 |
8321
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
394 // for(i=0;i<8;i++) |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
395 // printf("img_base[%d]=%p\n",i,((int*)decpar.dstPixMap.baseAddr)[i]); |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
396 |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
397 if((int)sh->context==0x73797639){ // Sorenson 16-bit YUV -> std YVU9 |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
398 |
8451 | 399 short *src0=(short *)((char*)decpar.dstPixMap.baseAddr+0x20); |
8321
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
400 |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
401 for(i=0;i<mpi->h;i++){ |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
402 int x; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
403 unsigned char* dst=mpi->planes[0]+i*mpi->stride[0]; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
404 unsigned short* src=src0+i*((mpi->w+15)&(~15)); |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
405 for(x=0;x<mpi->w;x++) dst[x]=src[x]; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
406 } |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
407 src0+=((mpi->w+15)&(~15))*((mpi->h+15)&(~15)); |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
408 for(i=0;i<mpi->h/4;i++){ |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
409 int x; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
410 unsigned char* dst=mpi->planes[1]+i*mpi->stride[1]; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
411 unsigned short* src=src0+i*(((mpi->w+63)&(~63))/4); |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
412 for(x=0;x<mpi->w/4;x++) dst[x]=src[x]; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
413 src+=((mpi->w+63)&(~63))/4; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
414 } |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
415 src0+=(((mpi->w+63)&(~63))/4)*(((mpi->h+63)&(~63))/4); |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
416 for(i=0;i<mpi->h/4;i++){ |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
417 int x; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
418 unsigned char* dst=mpi->planes[2]+i*mpi->stride[2]; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
419 unsigned short* src=src0+i*(((mpi->w+63)&(~63))/4); |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
420 for(x=0;x<mpi->w/4;x++) dst[x]=src[x]; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
421 src+=((mpi->w+63)&(~63))/4; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
422 } |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
423 |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
424 } |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
425 |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
426 |
8160 | 427 return mpi; |
428 } | |
429 #endif |