Mercurial > mplayer.hg
annotate libmpcodecs/vd_divx4.c @ 16390:1a0c19af8c7f
synced with 1.1087
author | gpoirier |
---|---|
date | Sun, 04 Sep 2005 21:48:51 +0000 |
parents | d275152390ee |
children | 023937301637 |
rev | line source |
---|---|
4968 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
5003 | 3 #include <stdarg.h> |
4968 | 4 #include <assert.h> |
5 | |
6 #include "config.h" | |
7 #include "mp_msg.h" | |
8 #include "help_mp.h" | |
9 | |
10 #ifdef USE_DIVX | |
11 #ifdef NEW_DECORE | |
12 | |
13 #include "vd_internal.h" | |
14 | |
15 static vd_info_t info = { | |
16 #ifdef DECORE_DIVX5 | |
9300
32be26de0d7c
cleanup detection of various divx4 versions/alternatives
arpi
parents:
7191
diff
changeset
|
17 "DivX5Linux lib", |
4968 | 18 #else |
9300
32be26de0d7c
cleanup detection of various divx4 versions/alternatives
arpi
parents:
7191
diff
changeset
|
19 #ifdef DECORE_XVID |
32be26de0d7c
cleanup detection of various divx4 versions/alternatives
arpi
parents:
7191
diff
changeset
|
20 "XviD lib (divx4 compat.)", |
32be26de0d7c
cleanup detection of various divx4 versions/alternatives
arpi
parents:
7191
diff
changeset
|
21 #else |
32be26de0d7c
cleanup detection of various divx4 versions/alternatives
arpi
parents:
7191
diff
changeset
|
22 "DivX4Linux lib", |
32be26de0d7c
cleanup detection of various divx4 versions/alternatives
arpi
parents:
7191
diff
changeset
|
23 #endif |
4968 | 24 #endif |
25 "divx4", | |
26 "A'rpi", | |
9300
32be26de0d7c
cleanup detection of various divx4 versions/alternatives
arpi
parents:
7191
diff
changeset
|
27 #ifdef DECORE_XVID |
32be26de0d7c
cleanup detection of various divx4 versions/alternatives
arpi
parents:
7191
diff
changeset
|
28 "http://www.xvid.com", |
32be26de0d7c
cleanup detection of various divx4 versions/alternatives
arpi
parents:
7191
diff
changeset
|
29 #else |
4968 | 30 "http://www.divx.com", |
9300
32be26de0d7c
cleanup detection of various divx4 versions/alternatives
arpi
parents:
7191
diff
changeset
|
31 #endif |
7191
1eadce15446c
-afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents:
7180
diff
changeset
|
32 "native binary codec" |
4968 | 33 }; |
34 | |
35 LIBVD_EXTERN(divx4) | |
36 | |
9300
32be26de0d7c
cleanup detection of various divx4 versions/alternatives
arpi
parents:
7191
diff
changeset
|
37 #ifdef DECORE_XVID |
6701
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
5247
diff
changeset
|
38 #include <divx4.h> |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
5247
diff
changeset
|
39 #else |
4968 | 40 #include <decore.h> |
6701
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
5247
diff
changeset
|
41 #endif |
4968 | 42 |
6708
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
43 #define USE_DIVX_BUILTIN_PP |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
44 |
10252
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
45 #ifndef DECORE_VERSION |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
46 #define DECORE_VERSION 0 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
47 #endif |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
48 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
49 #if DECORE_VERSION >= 20021112 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
50 static void* dec_handle = NULL; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
51 #endif |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
52 |
4968 | 53 // to set/get/query special features/parameters |
54 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
55 switch(cmd){ | |
6708
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
56 #ifdef USE_DIVX_BUILTIN_PP |
4968 | 57 case VDCTRL_QUERY_MAX_PP_LEVEL: |
10252
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
58 #if DECORE_VERSION >= 20021112 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
59 return 6; // divx4linux >= 5.0.5 -> 0..60 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
60 #else |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
61 return 10; // divx4linux < 5.0.5 -> 0..100 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
62 #endif |
4968 | 63 case VDCTRL_SET_PP_LEVEL: { |
10252
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
64 int quality=*((int*)arg); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
65 #if DECORE_VERSION >= 20021112 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
66 int32_t iInstruction, iPostproc; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
67 if(quality<0 || quality>6) quality=6; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
68 iInstruction = DEC_ADJ_POSTPROCESSING | DEC_ADJ_SET; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
69 iPostproc = quality*10; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
70 decore(dec_handle, DEC_OPT_ADJUST, &iInstruction, &iPostproc); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
71 #else |
4968 | 72 DEC_SET dec_set; |
10252
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
73 if(quality<0 || quality>10) quality=10; |
4968 | 74 dec_set.postproc_level=quality*10; |
75 decore(0x123,DEC_OPT_SETPP,&dec_set,NULL); | |
10252
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
76 #endif |
4968 | 77 return CONTROL_OK; |
78 } | |
6708
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
79 #endif |
5003 | 80 #if DECORE_VERSION >= 20011010 |
81 case VDCTRL_SET_EQUALIZER: { | |
82 va_list ap; | |
83 int value; | |
84 int option; | |
85 va_start(ap, arg); | |
86 value=va_arg(ap, int); | |
87 va_end(ap); | |
88 | |
10252
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
89 if(!strcasecmp(arg,"Brightness")) |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
90 #if DECORE_VERSION >= 20021112 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
91 option=DEC_ADJ_BRIGHTNESS | DEC_ADJ_SET; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
92 #else |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
93 option=DEC_GAMMA_BRIGHTNESS; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
94 #endif |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
95 else if(!strcasecmp(arg, "Contrast")) |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
96 #if DECORE_VERSION >= 20021112 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
97 option=DEC_ADJ_CONTRAST | DEC_ADJ_SET; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
98 #else |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
99 option=DEC_GAMMA_CONTRAST; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
100 #endif |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
101 else if(!strcasecmp(arg,"Saturation")) |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
102 #if DECORE_VERSION >= 20021112 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
103 option=DEC_ADJ_SATURATION | DEC_ADJ_SET; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
104 #else |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
105 option=DEC_GAMMA_SATURATION; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
106 #endif |
5003 | 107 else return CONTROL_FALSE; |
108 | |
6803 | 109 value = (value * 128) / 100; |
10252
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
110 #if DECORE_VERSION >= 20021112 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
111 decore(dec_handle, DEC_OPT_ADJUST, &option, &value); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
112 #else |
5003 | 113 decore(0x123, DEC_OPT_GAMMA, (void *)option, (void *) value); |
10252
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
114 #endif |
5003 | 115 return CONTROL_OK; |
116 } | |
117 #endif | |
4968 | 118 |
119 } | |
120 | |
121 return CONTROL_UNKNOWN; | |
122 } | |
123 | |
124 // init driver | |
125 static int init(sh_video_t *sh){ | |
10252
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
126 #if DECORE_VERSION >= 20021112 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
127 DEC_INIT dec_init; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
128 int iSize=sizeof(DivXBitmapInfoHeader); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
129 DivXBitmapInfoHeader* pbi=malloc(iSize); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
130 int32_t iInstruction; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
131 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
132 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
133 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
134 memset(&dec_init, 0, sizeof(dec_init)); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
135 memset(pbi, 0, iSize); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
136 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
137 switch(sh->format) { |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
138 case mmioFOURCC('D','I','V','3'): |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
139 dec_init.codec_version = 311; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
140 break; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
141 case mmioFOURCC('D','I','V','X'): |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
142 dec_init.codec_version = 412; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
143 break; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
144 case mmioFOURCC('D','X','5','0'): |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
145 default: // Fallback to DivX 5 behaviour |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
146 dec_init.codec_version = 500; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
147 } |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
148 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
149 // no smoothing of the CPU load |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
150 dec_init.smooth_playback = 0; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
151 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
152 pbi->biSize=iSize; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
153 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
154 switch(sh->codec->outfmt[sh->outfmtidx]){ |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
155 case IMGFMT_YV12: { |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
156 pbi->biCompression=mmioFOURCC('Y','V','1','2'); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
157 break; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
158 } |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
159 case IMGFMT_YUY2: { |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
160 pbi->biCompression=mmioFOURCC('Y','U','Y','2'); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
161 break; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
162 } |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
163 case IMGFMT_UYVY: { |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
164 pbi->biCompression=mmioFOURCC('U','Y','V','Y'); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
165 break; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
166 } |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
167 case IMGFMT_I420: { |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
168 pbi->biCompression=mmioFOURCC('I','4','2','0'); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
169 break; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
170 } |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
171 case IMGFMT_BGR15: { |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
172 pbi->biCompression=0; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
173 pbi->biBitCount=16; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
174 break; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
175 } |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
176 case IMGFMT_BGR16: { |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
177 pbi->biCompression=3; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
178 pbi->biBitCount=16; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
179 break; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
180 } |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
181 case IMGFMT_BGR24: { |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
182 pbi->biCompression=0; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
183 pbi->biBitCount=24; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
184 break; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
185 } |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
186 case IMGFMT_BGR32: { |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
187 pbi->biCompression=0; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
188 pbi->biBitCount=32; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
189 break; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
190 } |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
191 default: |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
192 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unsupported out_fmt: 0x%X\n",sh->codec->outfmt[sh->outfmtidx]); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
193 return 0; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
194 } |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
195 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
196 pbi->biWidth = sh->disp_w; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
197 pbi->biHeight = sh->disp_h; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
198 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
199 decore(&dec_handle, DEC_OPT_INIT, &dec_init, NULL); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
200 decore(dec_handle, DEC_OPT_SETOUT, pbi, NULL); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
201 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
202 #ifdef USE_DIVX_BUILTIN_PP |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
203 iInstruction = DEC_ADJ_POSTPROCESSING | DEC_ADJ_SET; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
204 decore(dec_handle, DEC_OPT_ADJUST, &iInstruction, &divx_quality); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
205 #endif |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
206 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
207 free(pbi); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
208 #else // DECORE_VERSION < 20021112 |
4968 | 209 DEC_PARAM dec_param; |
5003 | 210 DEC_SET dec_set; |
4968 | 211 int bits=16; |
212 | |
5168 | 213 #ifndef NEW_DECORE |
214 if(sh->format==mmioFOURCC('D','I','V','3')){ | |
215 mp_msg(MSGT_DECVIDEO,MSGL_INFO,"DivX 3.x not supported by opendivx decore - it requires divx4linux\n"); | |
216 return 0; // not supported | |
217 } | |
218 #endif | |
219 #ifndef DECORE_DIVX5 | |
220 if(sh->format==mmioFOURCC('D','X','5','0')){ | |
221 mp_msg(MSGT_DECVIDEO,MSGL_INFO,"DivX 5.00 not supported by divx4linux decore - it requires divx5linux\n"); | |
222 return 0; // not supported | |
223 } | |
224 #endif | |
225 | |
5124 | 226 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; |
227 | |
228 memset(&dec_param,0,sizeof(dec_param)); | |
4968 | 229 |
230 switch(sh->codec->outfmt[sh->outfmtidx]){ | |
231 case IMGFMT_YV12: dec_param.output_format=DEC_YV12;bits=12;break; | |
232 case IMGFMT_YUY2: dec_param.output_format=DEC_YUY2;break; | |
233 case IMGFMT_UYVY: dec_param.output_format=DEC_UYVY;break; | |
234 case IMGFMT_I420: dec_param.output_format=DEC_420;bits=12;break; | |
235 case IMGFMT_BGR15: dec_param.output_format=DEC_RGB555_INV;break; | |
236 case IMGFMT_BGR16: dec_param.output_format=DEC_RGB565_INV;break; | |
237 case IMGFMT_BGR24: dec_param.output_format=DEC_RGB24_INV;bits=24;break; | |
238 case IMGFMT_BGR32: dec_param.output_format=DEC_RGB32_INV;bits=32;break; | |
239 default: | |
240 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unsupported out_fmt: 0x%X\n",sh->codec->outfmt[sh->outfmtidx]); | |
241 return 0; | |
242 } | |
4997 | 243 #ifdef DECORE_DIVX5 |
5247 | 244 switch(sh->format) { |
245 case mmioFOURCC('D','I','V','3'): | |
246 dec_param.codec_version = 311; | |
247 break; | |
248 case mmioFOURCC('D','I','V','X'): | |
249 dec_param.codec_version = 400; | |
250 break; | |
251 case mmioFOURCC('D','X','5','0'): | |
252 default: // Fallback to DivX 5 behaviour | |
253 dec_param.codec_version = 500; | |
254 } | |
4997 | 255 dec_param.build_number = 0; |
256 #endif | |
4968 | 257 dec_param.x_dim = sh->disp_w; |
258 dec_param.y_dim = sh->disp_h; | |
259 decore(0x123, DEC_OPT_INIT, &dec_param, NULL); | |
5003 | 260 |
6708
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
261 #ifdef USE_DIVX_BUILTIN_PP |
5003 | 262 dec_set.postproc_level = divx_quality; |
263 decore(0x123, DEC_OPT_SETPP, &dec_set, NULL); | |
6708
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
264 #endif |
10252
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
265 #endif // DECORE_VERSION |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
266 |
4968 | 267 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: DivX4Linux video codec init OK!\n"); |
268 | |
269 return 1; | |
270 } | |
271 | |
272 // uninit driver | |
273 static void uninit(sh_video_t *sh){ | |
10252
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
274 #if DECORE_VERSION >= 20021112 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
275 decore(dec_handle, DEC_OPT_RELEASE, NULL, NULL); |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
276 dec_handle = NULL; |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
277 #else |
4968 | 278 decore(0x123,DEC_OPT_RELEASE,NULL,NULL); |
10252
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
279 #endif |
4968 | 280 } |
281 | |
282 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); | |
283 | |
284 // decode a frame | |
285 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
286 mp_image_t* mpi; | |
287 DEC_FRAME dec_frame; | |
6708
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
288 #ifndef USE_DIVX_BUILTIN_PP |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
289 DEC_FRAME_INFO frameinfo; |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
290 #endif |
4968 | 291 |
292 if(len<=0) return NULL; // skipped frame | |
293 | |
294 dec_frame.length = len; | |
295 dec_frame.bitstream = data; | |
6708
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
296 dec_frame.render_flag = (flags&VDFLAGS_DROPFRAME)?0:1; |
4968 | 297 |
298 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_PRESERVE | MP_IMGFLAG_ACCEPT_WIDTH, | |
299 sh->disp_w, sh->disp_h); | |
300 if(!mpi) return NULL; | |
301 | |
302 dec_frame.bmp=mpi->planes[0]; | |
303 dec_frame.stride=mpi->width; | |
6708
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
304 |
10252
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
305 decore( |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
306 #if DECORE_VERSION >= 20021112 |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
307 dec_handle, |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
308 #else |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
309 0x123, |
d275152390ee
I've found some time to implement the encoding support for the new
arpi
parents:
9300
diff
changeset
|
310 #endif |
5037 | 311 #ifndef DEC_OPT_FRAME_311 |
6708
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
312 DEC_OPT_FRAME, |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
313 #else |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
314 (sh->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
315 #endif |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
316 &dec_frame, |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
317 #ifndef USE_DIVX_BUILTIN_PP |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
318 &frameinfo |
4968 | 319 #else |
6708
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
320 NULL |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
321 #endif |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
322 ); |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
323 |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
324 #ifndef USE_DIVX_BUILTIN_PP |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
325 mpi->qscale = frameinfo.quant_store; |
8058078f1248
support for external pp by divx4. some fixes/cosmetics?
alex
parents:
6701
diff
changeset
|
326 mpi->qstride = frameinfo.quant_stride; |
4968 | 327 #endif |
328 | |
329 return mpi; | |
330 } | |
331 #endif | |
332 #endif |