annotate libmpcodecs/vd_xvid4.c @ 13493:5a16d1f4890b

I need Cola! -vf=eq2=1.0:-0.8 is the syntax for conf file, -vf eq2=1.0:-0.8 is the runtime syntax... Bummer!
author gpoirier
date Mon, 27 Sep 2004 19:09:43 +0000
parents 4f4b81257d19
children 3427a9f4b6e3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1 /*****************************************************************************
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
2 *
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
3 * - XviD 1.0 decoder module for mplayer/mencoder -
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
4 *
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
5 * Copyright(C) 2003 Marco Belli <elcabesa@inwind.it>
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
6 * 2003 Edouard Gomez <ed.gomez@free.fr>
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
7 *
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
11 * (at your option) any later version.
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
12 *
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
16 * GNU General Public License for more details.
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
17 *
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
21 *
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
22 *****************************************************************************/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
23
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
24 /*****************************************************************************
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
25 * Includes
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
26 ****************************************************************************/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
27
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
28 #include <stdio.h>
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
29 #include <stdlib.h>
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
30
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
31 #include "config.h"
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
32 #include "mp_msg.h"
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
33
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
34 #ifdef HAVE_XVID4
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
35
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
36 #include "vd_internal.h"
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
37 #include "m_option.h"
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
38
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
39 #include <xvid.h>
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
40
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
41 /*****************************************************************************
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
42 * Configuration options
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
43 ****************************************************************************/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
44
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
45 static int do_dr2 = 1;
11967
4f4b81257d19 Adds support for the film grain effect and deblocking filters in xvid
attila
parents: 11437
diff changeset
46 static int filmeffect = 0;
4f4b81257d19 Adds support for the film grain effect and deblocking filters in xvid
attila
parents: 11437
diff changeset
47 static int lumadeblock = 0;
4f4b81257d19 Adds support for the film grain effect and deblocking filters in xvid
attila
parents: 11437
diff changeset
48 static int chromadeblock = 0;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
49
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
50 m_option_t xvid_dec_opts[] = {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
51 { "dr2", &do_dr2, CONF_TYPE_FLAG, 0, 0, 1, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
52 { "nodr2", &do_dr2, CONF_TYPE_FLAG, 0, 1, 0, NULL},
11967
4f4b81257d19 Adds support for the film grain effect and deblocking filters in xvid
attila
parents: 11437
diff changeset
53 { "filmeffect", &filmeffect, CONF_TYPE_FLAG, 0, 0, 1, NULL},
4f4b81257d19 Adds support for the film grain effect and deblocking filters in xvid
attila
parents: 11437
diff changeset
54 { "deblock-luma", &lumadeblock, CONF_TYPE_FLAG, 0, 0, 1, NULL},
4f4b81257d19 Adds support for the film grain effect and deblocking filters in xvid
attila
parents: 11437
diff changeset
55 { "deblock-chroma", &chromadeblock, CONF_TYPE_FLAG, 0, 0, 1, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
56 {NULL, NULL, 0, 0, 0, 0, NULL}
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
57 };
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
58
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
59 /*****************************************************************************
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
60 * Module private data
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
61 ****************************************************************************/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
62
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
63 typedef struct {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
64 int cs;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
65 unsigned char img_type;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
66 void* hdl;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
67 mp_image_t* mpi;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
68 } priv_t;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
69
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
70 /*****************************************************************************
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
71 * Video decoder API function definitions
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
72 ****************************************************************************/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
73
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
74 /*============================================================================
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
75 * control - to set/get/query special features/parameters
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
76 *==========================================================================*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
77
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
78 static int control(sh_video_t *sh,int cmd,void* arg,...)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
79 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
80 return(CONTROL_UNKNOWN);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
81 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
82
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
83 /*============================================================================
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
84 * init - initialize the codec
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
85 *==========================================================================*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
86
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
87 static int init(sh_video_t *sh)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
88 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
89 xvid_gbl_init_t xvid_ini;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
90 xvid_dec_create_t dec_p;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
91 priv_t* p;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
92 int cs;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
93
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
94 memset(&xvid_ini, 0, sizeof(xvid_gbl_init_t));
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
95 xvid_ini.version = XVID_VERSION;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
96 memset(&dec_p, 0, sizeof(xvid_dec_create_t));
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
97 dec_p.version = XVID_VERSION;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
98
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
99 if(!mpcodecs_config_vo(sh, sh->disp_w, sh->disp_h, IMGFMT_YV12))
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
100 return(0);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
101
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
102 switch(sh->codec->outfmt[sh->outfmtidx]){
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
103 case IMGFMT_YV12:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
104 /* We will use our own buffers, this speeds decoding avoiding
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
105 * frame memcpy's overhead */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
106 cs = (do_dr2)?XVID_CSP_INTERNAL:XVID_CSP_USER;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
107 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
108 case IMGFMT_YUY2:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
109 cs = XVID_CSP_YUY2;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
110 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
111 case IMGFMT_UYVY:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
112 cs = XVID_CSP_UYVY;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
113 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
114 case IMGFMT_I420:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
115 case IMGFMT_IYUV:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
116 /* We will use our own buffers, this speeds decoding avoiding
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
117 * frame memcpy's overhead */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
118 cs = (do_dr2)?XVID_CSP_INTERNAL:XVID_CSP_USER;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
119 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
120 case IMGFMT_BGR15:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
121 cs = XVID_CSP_RGB555;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
122 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
123 case IMGFMT_BGR16:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
124 cs = XVID_CSP_RGB565;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
125 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
126 case IMGFMT_BGR32:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
127 cs = XVID_CSP_BGRA;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
128 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
129 case IMGFMT_YVYU:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
130 cs = XVID_CSP_YVYU;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
131 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
132 default:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
133 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Unsupported out_fmt: 0x%X\n",
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
134 sh->codec->outfmt[sh->outfmtidx]);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
135 return(0);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
136 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
137
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
138 if(xvid_global(NULL, XVID_GBL_INIT, &xvid_ini, NULL))
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
139 return(0);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
140
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
141 dec_p.width = sh->disp_w;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
142 dec_p.height = sh->disp_h;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
143
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
144 if(xvid_decore(0, XVID_DEC_CREATE, &dec_p, NULL)<0) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
145 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "XviD init failed\n");
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
146 return(0);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
147 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
148
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
149 p = (priv_t*)malloc(sizeof(priv_t));
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
150 p->cs = cs;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
151 p->hdl = dec_p.handle;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
152 sh->context = p;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
153
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
154 switch(cs) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
155 case XVID_CSP_INTERNAL:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
156 p->img_type = MP_IMGTYPE_EXPORT;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
157 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
158 case XVID_CSP_USER:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
159 p->img_type = MP_IMGTYPE_STATIC;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
160 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
161 default:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
162 p->img_type = MP_IMGTYPE_TEMP;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
163 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
164 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
165
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
166 return(1);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
167 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
168
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
169 /*============================================================================
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
170 * uninit - close the codec
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
171 *==========================================================================*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
172
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
173 static void uninit(sh_video_t *sh){
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
174 priv_t* p = sh->context;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
175 if(!p)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
176 return;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
177 xvid_decore(p->hdl,XVID_DEC_DESTROY, NULL, NULL);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
178 free(p);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
179 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
180
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
181 /*============================================================================
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
182 * decode - decode a frame from stream
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
183 *==========================================================================*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
184
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
185 static mp_image_t* decode(sh_video_t *sh, void* data, int len, int flags)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
186 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
187 xvid_dec_frame_t dec;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
188 priv_t* p = sh->context;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
189
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
190 mp_image_t* mpi = mpcodecs_get_image(sh, p->img_type,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
191 MP_IMGFLAG_ACCEPT_STRIDE,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
192 sh->disp_w,sh->disp_h);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
193
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
194 if(!data || !mpi || len <= 0)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
195 return(NULL);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
196
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
197 memset(&dec,0,sizeof(xvid_dec_frame_t));
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
198 dec.version = XVID_VERSION;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
199
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
200 dec.bitstream = data;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
201 dec.length = len;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
202
11967
4f4b81257d19 Adds support for the film grain effect and deblocking filters in xvid
attila
parents: 11437
diff changeset
203 dec.general |= XVID_LOWDELAY
4f4b81257d19 Adds support for the film grain effect and deblocking filters in xvid
attila
parents: 11437
diff changeset
204 | (filmeffect ? XVID_FILMEFFECT : 0 )
4f4b81257d19 Adds support for the film grain effect and deblocking filters in xvid
attila
parents: 11437
diff changeset
205 | (lumadeblock ? XVID_DEBLOCKY : 0 )
4f4b81257d19 Adds support for the film grain effect and deblocking filters in xvid
attila
parents: 11437
diff changeset
206 | (chromadeblock ? XVID_DEBLOCKUV : 0 );
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
207
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
208 dec.output.csp = p->cs;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
209
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
210 if(p->cs != XVID_CSP_INTERNAL) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
211 dec.output.plane[0] = mpi->planes[0];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
212 dec.output.plane[1] = mpi->planes[1];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
213 dec.output.plane[2] = mpi->planes[2];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
214
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
215 dec.output.stride[0] = mpi->stride[0];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
216 dec.output.stride[1] = mpi->stride[1];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
217 dec.output.stride[2] = mpi->stride[2];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
218 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
219
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
220 if(xvid_decore(p->hdl, XVID_DEC_DECODE, &dec, NULL) < 0) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
221 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Decoding error\n");
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
222 return(NULL);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
223 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
224
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
225 if(p->cs == XVID_CSP_INTERNAL) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
226 mpi->planes[0] = dec.output.plane[0];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
227 mpi->planes[1] = dec.output.plane[1];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
228 mpi->planes[2] = dec.output.plane[2];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
229
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
230 mpi->stride[0] = dec.output.stride[0];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
231 mpi->stride[1] = dec.output.stride[1];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
232 mpi->stride[2] = dec.output.stride[2];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
233 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
234
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
235 return(mpi);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
236 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
237
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
238 /*****************************************************************************
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
239 * Module structure definition
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
240 ****************************************************************************/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
241
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
242 static vd_info_t info =
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
243 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
244 "XviD 1.0 decoder",
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
245 "xvid",
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
246 "Marco Belli <elcabesa@inwind.it>, Edouard Gomez <ed.gomez@free.fr>",
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
247 "Marco Belli <elcabesa@inwind.it>, Edouard Gomez <ed.gomez@free.fr>",
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
248 "No Comment"
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
249 };
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
250
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
251 LIBVD_EXTERN(xvid)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
252
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
253 #endif /* HAVE_XVID4 */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
254
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
255 /* Please do not change that tag comment.
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
256 * arch-tag: b7d654a5-76ea-4768-9713-2c791567fe7d mplayer xvid decoder module */