comparison dsputil.h @ 1102:eeaa1e837efb libavcodec

more dox
author michaelni
date Thu, 06 Mar 2003 10:08:15 +0000
parents f59c3f66363b
children 6a01ffc5351c
comparison
equal deleted inserted replaced
1101:a3a8017dee70 1102:eeaa1e837efb
14 * 14 *
15 * You should have received a copy of the GNU Lesser General Public 15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software 16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19
20 /**
21 * @file dsputil.h
22 * @brief DSP utils
23 *
24 */
25
19 #ifndef DSPUTIL_H 26 #ifndef DSPUTIL_H
20 #define DSPUTIL_H 27 #define DSPUTIL_H
21 28
22 #include "common.h" 29 #include "common.h"
23 #include "avcodec.h" 30 #include "avcodec.h"
31
24 32
25 //#define DEBUG 33 //#define DEBUG
26 /* dct code */ 34 /* dct code */
27 typedef short DCTELEM; 35 typedef short DCTELEM;
28 //typedef int DCTELEM; 36 //typedef int DCTELEM;
98 106
99 typedef int (*op_pixels_abs_func)(uint8_t *blk1/*align width (8 or 16)*/, uint8_t *blk2/*align 1*/, int line_size)/* __attribute__ ((const))*/; 107 typedef int (*op_pixels_abs_func)(uint8_t *blk1/*align width (8 or 16)*/, uint8_t *blk2/*align 1*/, int line_size)/* __attribute__ ((const))*/;
100 108
101 typedef int (*me_cmp_func)(void /*MpegEncContext*/ *s, uint8_t *blk1/*align width (8 or 16)*/, uint8_t *blk2/*align 1*/, int line_size)/* __attribute__ ((const))*/; 109 typedef int (*me_cmp_func)(void /*MpegEncContext*/ *s, uint8_t *blk1/*align width (8 or 16)*/, uint8_t *blk2/*align 1*/, int line_size)/* __attribute__ ((const))*/;
102 110
111 /**
112 * DSPContext.
113 */
103 typedef struct DSPContext { 114 typedef struct DSPContext {
104 /* pixel ops : interface with DCT */ 115 /* pixel ops : interface with DCT */
105 void (*get_pixels)(DCTELEM *block/*align 16*/, const uint8_t *pixels/*align 8*/, int line_size); 116 void (*get_pixels)(DCTELEM *block/*align 16*/, const uint8_t *pixels/*align 8*/, int line_size);
106 void (*diff_pixels)(DCTELEM *block/*align 16*/, const uint8_t *s1/*align 8*/, const uint8_t *s2/*align 8*/, int stride); 117 void (*diff_pixels)(DCTELEM *block/*align 16*/, const uint8_t *s1/*align 8*/, const uint8_t *s2/*align 8*/, int stride);
107 void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size); 118 void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
150 void (*add_bytes)(uint8_t *dst/*align 16*/, uint8_t *src/*align 16*/, int w); 161 void (*add_bytes)(uint8_t *dst/*align 16*/, uint8_t *src/*align 16*/, int w);
151 void (*diff_bytes)(uint8_t *dst/*align 16*/, uint8_t *src1/*align 16*/, uint8_t *src2/*align 1*/,int w); 162 void (*diff_bytes)(uint8_t *dst/*align 16*/, uint8_t *src1/*align 16*/, uint8_t *src2/*align 1*/,int w);
152 163
153 /* (I)DCT */ 164 /* (I)DCT */
154 void (*fdct)(DCTELEM *block/* align 16*/); 165 void (*fdct)(DCTELEM *block/* align 16*/);
166
167 /**
168 * block -> idct -> clip to unsigned 8 bit -> dest.<br>
169 * (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...)
170 * @param line_size size in pixels of a horizotal line of dest
171 */
155 void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/); 172 void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
173
174 /**
175 * block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
176 * @param line_size size in pixels of a horizotal line of dest
177 */
156 void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/); 178 void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
179
180 /**
181 * idct input permutation.<br>
182 * an example to avoid confusion:
183 * - (->decode coeffs -> zigzag reorder -> dequant -> reference idct ->...)
184 * - (x -> referece dct -> reference idct -> x)
185 * - (x -> referece dct -> simple_mmx_perm = idct_permutation -> simple_idct_mmx -> x)
186 * - (->decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant -> simple_idct_mmx ->...)
187 */
157 uint8_t idct_permutation[64]; 188 uint8_t idct_permutation[64];
158 int idct_permutation_type; 189 int idct_permutation_type;
159 #define FF_NO_IDCT_PERM 1 190 #define FF_NO_IDCT_PERM 1
160 #define FF_LIBMPEG2_IDCT_PERM 2 191 #define FF_LIBMPEG2_IDCT_PERM 2
161 #define FF_SIMPLE_IDCT_PERM 3 192 #define FF_SIMPLE_IDCT_PERM 3
169 * permute block according to permuatation. 200 * permute block according to permuatation.
170 * @param last last non zero element in scantable order 201 * @param last last non zero element in scantable order
171 */ 202 */
172 void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last); 203 void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last);
173 204
205 /**
206 * Empty mmx state.<br>
207 * this must be called between any dsp function and float/double code.
208 * for example sin(); dsp->idct_put(); emms_c(); cos()
209 */
174 #define emms_c() 210 #define emms_c()
175 211
176 /* should be defined by architectures supporting 212 /* should be defined by architectures supporting
177 one or more MultiMedia extension */ 213 one or more MultiMedia extension */
178 int mm_support(void); 214 int mm_support(void);