annotate libmpcodecs/vd_divx4.c @ 19066:26a30496ec96

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