169
|
1 #include <stdio.h>
|
|
2 #include <stdlib.h>
|
|
3
|
|
4 #include "formats.h"
|
|
5 #include "com.h"
|
|
6
|
|
7 #include "DS_VideoDec.h"
|
|
8
|
|
9 int main(int argc,char* argv[]){
|
|
10 FILE *f;
|
|
11 BITMAPINFOHEADER bih;
|
|
12 int len;
|
|
13 char *src;
|
|
14 char *dst=0;
|
|
15 GUID CLSID_DivxDecompressorCF={0x82CCd3E0, 0xF71A, 0x11D0,
|
|
16 { 0x9f, 0xe5, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}};
|
|
17
|
|
18 f=fopen("test.divx","rb");
|
|
19
|
|
20 fread(&bih,sizeof(BITMAPINFOHEADER),1,f);
|
170
|
21 printf("frame dim: %d x %d \n",(int)bih.biWidth,(int)bih.biHeight);
|
169
|
22
|
18878
|
23 src=malloc(512000);
|
169
|
24 len=fread(src,1,512000,f);
|
|
25 printf("frame len = %d\n",len);
|
|
26
|
|
27 DS_VideoDecoder_Open("divx_c32.ax", &CLSID_DivxDecompressorCF, &bih, 0, &dst);
|
|
28
|
|
29 // DS_VideoDecoder_SetDestFmt(16,fccYUY2);
|
|
30 DS_VideoDecoder_SetDestFmt(24,0);
|
|
31
|
184
|
32 printf("DivX setting result = %d\n", DS_SetAttr_DivX("Quality",4) );
|
|
33
|
169
|
34 DS_VideoDecoder_Start();
|
|
35
|
|
36 printf("DivX setting result = %d\n", DS_SetValue_DivX("Brightness",60) );
|
|
37
|
|
38 DS_VideoDecoder_DecodeFrame(src, len, 1, 1);
|
|
39
|
|
40 #if 0
|
|
41 f2=fopen("test.yuy2","wb");
|
|
42 fwrite(dst,bih.biWidth*bih.biHeight*2,1,f2);
|
|
43 fclose(f2);
|
|
44 #endif
|
|
45
|
|
46 { unsigned char raw_head[32];
|
|
47 FILE *f=fopen("test.raw","wb");
|
|
48
|
|
49 strcpy((char*)raw_head,"mhwanh");
|
|
50 raw_head[7]=4;
|
|
51 raw_head[8]=bih.biWidth>>8;
|
|
52 raw_head[9]=bih.biWidth&0xFF;
|
|
53 raw_head[10]=bih.biHeight>>8;
|
|
54 raw_head[11]=bih.biHeight&0xFF;
|
|
55 raw_head[12]=raw_head[13]=0; // 24bit
|
|
56 raw_head[14]=1;raw_head[15]=0x2C;
|
|
57 raw_head[16]=1;raw_head[17]=0x2C;
|
|
58 memset(raw_head+18,0,32-18);
|
|
59 fwrite(raw_head,32,1,f);
|
|
60
|
|
61 fwrite(dst,bih.biWidth*bih.biHeight*3,1,f);
|
|
62 fclose(f);
|
|
63 }
|
|
64
|
|
65
|
|
66 return 0;
|
|
67 }
|