annotate h264idct.c @ 2661:b2846918585c libavcodec

a few #ifdef CONFIG_X_ENCODER, patch by (Roine Gustafsson <roine users.sourceforge net]
author michael
date Tue, 10 May 2005 20:39:11 +0000
parents cd43603c46f9
children 975074f04b95
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2272
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
1 /*
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
2 * H.264 IDCT
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
3 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
4 *
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
9 *
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
13 * Lesser General Public License for more details.
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
14 *
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
18 *
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
19 */
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
20
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
21 /**
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
22 * @file h264-idct.c
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
23 * H.264 IDCT.
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
24 * @author Michael Niedermayer <michaelni@gmx.at>
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
25 */
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
26
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
27 #include "dsputil.h"
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
28
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
29 static always_inline void idct_internal(uint8_t *dst, DCTELEM *block, int stride, int block_stride, int shift, int add){
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
30 int i;
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
31 uint8_t *cm = cropTbl + MAX_NEG_CROP;
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
32
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
33 block[0] += 1<<(shift-1);
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
34
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
35 for(i=0; i<4; i++){
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
36 const int z0= block[0 + block_stride*i] + block[2 + block_stride*i];
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
37 const int z1= block[0 + block_stride*i] - block[2 + block_stride*i];
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
38 const int z2= (block[1 + block_stride*i]>>1) - block[3 + block_stride*i];
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
39 const int z3= block[1 + block_stride*i] + (block[3 + block_stride*i]>>1);
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
40
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
41 block[0 + block_stride*i]= z0 + z3;
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
42 block[1 + block_stride*i]= z1 + z2;
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
43 block[2 + block_stride*i]= z1 - z2;
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
44 block[3 + block_stride*i]= z0 - z3;
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
45 }
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
46
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
47 for(i=0; i<4; i++){
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
48 const int z0= block[i + block_stride*0] + block[i + block_stride*2];
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
49 const int z1= block[i + block_stride*0] - block[i + block_stride*2];
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
50 const int z2= (block[i + block_stride*1]>>1) - block[i + block_stride*3];
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
51 const int z3= block[i + block_stride*1] + (block[i + block_stride*3]>>1);
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
52
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
53 dst[i + 0*stride]= cm[ add*dst[i + 0*stride] + ((z0 + z3) >> shift) ];
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
54 dst[i + 1*stride]= cm[ add*dst[i + 1*stride] + ((z1 + z2) >> shift) ];
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
55 dst[i + 2*stride]= cm[ add*dst[i + 2*stride] + ((z1 - z2) >> shift) ];
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
56 dst[i + 3*stride]= cm[ add*dst[i + 3*stride] + ((z0 - z3) >> shift) ];
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
57 }
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
58 }
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
59
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
60 void ff_h264_idct_add_c(uint8_t *dst, DCTELEM *block, int stride){
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
61 idct_internal(dst, block, stride, 4, 6, 1);
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
62 }
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
63
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
64 void ff_h264_lowres_idct_add_c(uint8_t *dst, int stride, DCTELEM *block){
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
65 idct_internal(dst, block, stride, 8, 3, 1);
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
66 }
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
67
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
68 void ff_h264_lowres_idct_put_c(uint8_t *dst, int stride, DCTELEM *block){
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
69 idct_internal(dst, block, stride, 8, 3, 0);
cd43603c46f9 move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
diff changeset
70 }