1 |
/************************************************************************** |
/***************************************************************************** |
2 |
* |
* |
3 |
* XVID MPEG-4 VIDEO CODEC |
* XVID MPEG-4 VIDEO CODEC |
4 |
* - OpenDivx API wrapper - |
* - DivX 4.x compatibility layer (Deprecated and not up2date code) - |
5 |
* |
* |
6 |
* This program is an implementation of a part of one or more MPEG-4 |
* Copyright(C) 2001-2003 Peter Ross <pross@xvid.org> |
7 |
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
* 2002-2003 Edouard Gomez <ed.gomez@free.fr> |
|
* to use this software module in hardware or software products are |
|
|
* advised that its use may infringe existing patents or copyrights, and |
|
|
* any such use would be at such party's own risk. The original |
|
|
* developer of this software module and his/her company, and subsequent |
|
|
* editors and their companies, will have no liability for use of this |
|
|
* software or modifications or derivatives thereof. |
|
8 |
* |
* |
9 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
10 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
18 |
* |
* |
19 |
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
20 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
21 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
* |
|
|
*************************************************************************/ |
|
|
|
|
|
/************************************************************************** |
|
|
* |
|
|
* History: |
|
|
* |
|
|
* 24.02.2002 #def BFRAMES compatibility |
|
|
* 26.02.2001 fixed dec_csp bugs |
|
|
* 26.12.2001 xvid_init() support |
|
|
* 22.12.2001 removed some compiler warnings |
|
|
* 16.12.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> |
|
22 |
* |
* |
23 |
* $Id$ |
* $Id$ |
24 |
* |
* |
25 |
*************************************************************************/ |
****************************************************************************/ |
26 |
|
|
27 |
#include <stdlib.h> |
#include <stdlib.h> |
28 |
#include <string.h> |
#include <string.h> |
35 |
|
|
36 |
#define EMULATED_DIVX_VERSION 20011001 |
#define EMULATED_DIVX_VERSION 20011001 |
37 |
|
|
38 |
/************************************************************************** |
/***************************************************************************** |
39 |
* Divx Instance Structure |
* Divx Instance Structure |
40 |
* |
* |
41 |
* This chain list datatype allows XviD do instanciate multiples divx4 |
* This chain list datatype allows XviD do instanciate multiples divx4 |
45 |
* because they are not protected by any kind of mutex to allow |
* because they are not protected by any kind of mutex to allow |
46 |
* only one modifier. We should add a mutex for each element in |
* only one modifier. We should add a mutex for each element in |
47 |
* the chainlist. |
* the chainlist. |
48 |
*************************************************************************/ |
****************************************************************************/ |
49 |
|
|
50 |
|
|
51 |
typedef struct DINST |
typedef struct DINST |
69 |
} |
} |
70 |
EINST; |
EINST; |
71 |
|
|
72 |
/************************************************************************** |
/***************************************************************************** |
73 |
* Global data (needed to emulate correctly exported symbols from divx4) |
* Global data (needed to emulate correctly exported symbols from divx4) |
74 |
*************************************************************************/ |
****************************************************************************/ |
75 |
|
|
76 |
/* This is not used in this module but is required by some divx4 encoders*/ |
/* This is not used in this module but is required by some divx4 encoders*/ |
77 |
int quiet_encore = 1; |
int quiet_encore = 1; |
78 |
|
|
79 |
/************************************************************************** |
/***************************************************************************** |
80 |
* Local data |
* Local data |
81 |
*************************************************************************/ |
****************************************************************************/ |
82 |
|
|
83 |
/* The Divx4 instance chainlist */ |
/* The Divx4 instance chainlist */ |
84 |
static DINST *dhead = NULL; |
static DINST *dhead = NULL; |
113 |
XVID_H263QUANT | XVID_VOP_INTER4V | XVID_VOP_HALFPEL |
XVID_H263QUANT | XVID_VOP_INTER4V | XVID_VOP_HALFPEL |
114 |
}; |
}; |
115 |
|
|
116 |
/************************************************************************** |
/***************************************************************************** |
117 |
* Local Prototypes |
* Local Prototypes |
118 |
*************************************************************************/ |
****************************************************************************/ |
119 |
|
|
120 |
/* Chain list helper functions */ |
/* Chain list helper functions */ |
121 |
static DINST *dinst_find(unsigned long key); |
static DINST *dinst_find(unsigned long key); |
130 |
static int xvid_to_opendivx_dec_csp(int csp); |
static int xvid_to_opendivx_dec_csp(int csp); |
131 |
static int xvid_to_opendivx_enc_csp(int csp); |
static int xvid_to_opendivx_enc_csp(int csp); |
132 |
|
|
133 |
/************************************************************************** |
/***************************************************************************** |
134 |
* decore part |
* decore part |
135 |
* |
* |
136 |
* decore is the divx4 entry point used to decompress the mpeg4 bitstream |
* decore is the divx4 entry point used to decompress the mpeg4 bitstream |
137 |
* into a user defined image format. |
* into a user defined image format. |
138 |
*************************************************************************/ |
****************************************************************************/ |
139 |
|
|
140 |
int |
int |
141 |
decore(unsigned long key, |
decore(unsigned long key, |
301 |
} |
} |
302 |
} |
} |
303 |
|
|
304 |
/************************************************************************** |
/***************************************************************************** |
305 |
* Encore Part |
* Encore Part |
306 |
* |
* |
307 |
* encore is the divx4 entry point used to compress a frame to a mpeg4 |
* encore is the divx4 entry point used to compress a frame to a mpeg4 |
308 |
* bitstream. |
* bitstream. |
309 |
*************************************************************************/ |
****************************************************************************/ |
310 |
|
|
311 |
#define FRAMERATE_INCR 1001 |
#define FRAMERATE_INCR 1001 |
312 |
|
|
461 |
} |
} |
462 |
} |
} |
463 |
|
|
464 |
/************************************************************************** |
/***************************************************************************** |
465 |
* Local Functions |
* Local Functions |
466 |
*************************************************************************/ |
****************************************************************************/ |
467 |
|
|
468 |
/*************************************** |
/*************************************** |
469 |
* DINST chainlist helper functions * |
* DINST chainlist helper functions * |