annotate simple_idct.c @ 12497:c5ffa8b81f9c libavcodec

Move sse16_sse2() from inline asm to yasm. It is one of the functions causing Win64/FATE issues.
author rbultje
date Fri, 17 Sep 2010 01:44:17 +0000
parents 7dd2a45249a9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
175
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
1 /*
429
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
2 * Simple IDCT
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
3 *
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
4 * Copyright (c) 2001 Michael Niedermayer <michaelni@gmx.at>
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
5 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
6 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
7 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
429
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
10 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
429
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
12 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
429
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
16 * Lesser General Public License for more details.
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
17 *
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 2979
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
429
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
21 */
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1106
diff changeset
22
1106
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
23 /**
11644
7dd2a45249a9 Remove explicit filename from Doxygen @file commands.
diego
parents: 9985
diff changeset
24 * @file
1106
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
25 * simpleidct in C.
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
26 */
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1106
diff changeset
27
175
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
28 /*
429
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
29 based upon some outcommented c code from mpeg2dec (idct_mmx.c
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1106
diff changeset
30 written by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>)
429
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
31 */
396
fce0a2520551 removed useless header includes - use av memory functions
glantau
parents: 352
diff changeset
32 #include "avcodec.h"
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
33 #include "dsputil.h"
8497
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
34 #include "mathops.h"
175
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
35 #include "simple_idct.h"
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
36
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
37 #if 0
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
38 #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
39 #define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
40 #define W3 2408 /* 2048*sqrt (2)*cos (3*pi/16) */
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
41 #define W4 2048 /* 2048*sqrt (2)*cos (4*pi/16) */
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
42 #define W5 1609 /* 2048*sqrt (2)*cos (5*pi/16) */
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
43 #define W6 1108 /* 2048*sqrt (2)*cos (6*pi/16) */
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
44 #define W7 565 /* 2048*sqrt (2)*cos (7*pi/16) */
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
45 #define ROW_SHIFT 8
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
46 #define COL_SHIFT 17
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
47 #else
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
48 #define W1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
49 #define W2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
50 #define W3 19266 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
352
5a8eb5cf9f92 C4=16383 for the c version too and even for some outcommented code
michaelni
parents: 215
diff changeset
51 #define W4 16383 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
175
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
52 #define W5 12873 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
53 #define W6 8867 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
54 #define W7 4520 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
55 #define ROW_SHIFT 11
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
56 #define COL_SHIFT 20 // 6
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
57 #endif
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
58
1008
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
59 static inline void idctRowCondDC (DCTELEM * row)
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
60 {
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
61 int a0, a1, a2, a3, b0, b1, b2, b3;
8590
7a463923ecd1 Change semantic of CONFIG_*, HAVE_* and ARCH_*.
aurel
parents: 8497
diff changeset
62 #if HAVE_FAST_64BIT
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
63 uint64_t temp;
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
64 #else
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
65 uint32_t temp;
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
66 #endif
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
67
8590
7a463923ecd1 Change semantic of CONFIG_*, HAVE_* and ARCH_*.
aurel
parents: 8497
diff changeset
68 #if HAVE_FAST_64BIT
9985
266bf83f634d Replace WORDS_BIGENDIAN with HAVE_BIGENDIAN
mru
parents: 8718
diff changeset
69 #if HAVE_BIGENDIAN
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
70 #define ROW0_MASK 0xffff000000000000LL
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
71 #else
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
72 #define ROW0_MASK 0xffffLL
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
73 #endif
1008
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
74 if(sizeof(DCTELEM)==2){
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1106
diff changeset
75 if ( ((((uint64_t *)row)[0] & ~ROW0_MASK) |
1008
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
76 ((uint64_t *)row)[1]) == 0) {
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
77 temp = (row[0] << 3) & 0xffff;
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
78 temp += temp << 16;
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
79 temp += temp << 32;
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
80 ((uint64_t *)row)[0] = temp;
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
81 ((uint64_t *)row)[1] = temp;
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
82 return;
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
83 }
1008
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
84 }else{
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
85 if (!(row[1]|row[2]|row[3]|row[4]|row[5]|row[6]|row[7])) {
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
86 row[0]=row[1]=row[2]=row[3]=row[4]=row[5]=row[6]=row[7]= row[0] << 3;
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
87 return;
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
88 }
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
89 }
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
90 #else
1008
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
91 if(sizeof(DCTELEM)==2){
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
92 if (!(((uint32_t*)row)[1] |
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
93 ((uint32_t*)row)[2] |
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1106
diff changeset
94 ((uint32_t*)row)[3] |
1008
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
95 row[1])) {
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
96 temp = (row[0] << 3) & 0xffff;
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
97 temp += temp << 16;
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
98 ((uint32_t*)row)[0]=((uint32_t*)row)[1] =
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
99 ((uint32_t*)row)[2]=((uint32_t*)row)[3] = temp;
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
100 return;
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
101 }
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
102 }else{
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
103 if (!(row[1]|row[2]|row[3]|row[4]|row[5]|row[6]|row[7])) {
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
104 row[0]=row[1]=row[2]=row[3]=row[4]=row[5]=row[6]=row[7]= row[0] << 3;
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
105 return;
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
106 }
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
107 }
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
108 #endif
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
109
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
110 a0 = (W4 * row[0]) + (1 << (ROW_SHIFT - 1));
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
111 a1 = a0;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
112 a2 = a0;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
113 a3 = a0;
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
114
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
115 /* no need to optimize : gcc does it */
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
116 a0 += W2 * row[2];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
117 a1 += W6 * row[2];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
118 a2 -= W6 * row[2];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
119 a3 -= W2 * row[2];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
120
8497
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
121 b0 = MUL16(W1, row[1]);
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
122 MAC16(b0, W3, row[3]);
8497
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
123 b1 = MUL16(W3, row[1]);
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
124 MAC16(b1, -W7, row[3]);
8497
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
125 b2 = MUL16(W5, row[1]);
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
126 MAC16(b2, -W1, row[3]);
8497
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
127 b3 = MUL16(W7, row[1]);
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
128 MAC16(b3, -W5, row[3]);
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
129
8590
7a463923ecd1 Change semantic of CONFIG_*, HAVE_* and ARCH_*.
aurel
parents: 8497
diff changeset
130 #if HAVE_FAST_64BIT
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
131 temp = ((uint64_t*)row)[1];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
132 #else
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
133 temp = ((uint32_t*)row)[2] | ((uint32_t*)row)[3];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
134 #endif
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
135 if (temp != 0) {
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
136 a0 += W4*row[4] + W6*row[6];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
137 a1 += - W4*row[4] - W2*row[6];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
138 a2 += - W4*row[4] + W2*row[6];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
139 a3 += W4*row[4] - W6*row[6];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
140
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
141 MAC16(b0, W5, row[5]);
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
142 MAC16(b0, W7, row[7]);
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1106
diff changeset
143
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
144 MAC16(b1, -W1, row[5]);
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
145 MAC16(b1, -W5, row[7]);
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1106
diff changeset
146
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
147 MAC16(b2, W7, row[5]);
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
148 MAC16(b2, W3, row[7]);
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1106
diff changeset
149
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
150 MAC16(b3, W3, row[5]);
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
151 MAC16(b3, -W1, row[7]);
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
152 }
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
153
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
154 row[0] = (a0 + b0) >> ROW_SHIFT;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
155 row[7] = (a0 - b0) >> ROW_SHIFT;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
156 row[1] = (a1 + b1) >> ROW_SHIFT;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
157 row[6] = (a1 - b1) >> ROW_SHIFT;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
158 row[2] = (a2 + b2) >> ROW_SHIFT;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
159 row[5] = (a2 - b2) >> ROW_SHIFT;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
160 row[3] = (a3 + b3) >> ROW_SHIFT;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
161 row[4] = (a3 - b3) >> ROW_SHIFT;
175
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
162 }
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
163
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1106
diff changeset
164 static inline void idctSparseColPut (uint8_t *dest, int line_size,
1008
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
165 DCTELEM * col)
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
166 {
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
167 int a0, a1, a2, a3, b0, b1, b2, b3;
4176
23da44e8fd05 rename cropTbl -> ff_cropTbl
mru
parents: 3947
diff changeset
168 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
169
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
170 /* XXX: I did that only to give same values as previous code */
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
171 a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
172 a1 = a0;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
173 a2 = a0;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
174 a3 = a0;
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
175
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
176 a0 += + W2*col[8*2];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
177 a1 += + W6*col[8*2];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
178 a2 += - W6*col[8*2];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
179 a3 += - W2*col[8*2];
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
180
8497
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
181 b0 = MUL16(W1, col[8*1]);
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
182 b1 = MUL16(W3, col[8*1]);
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
183 b2 = MUL16(W5, col[8*1]);
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
184 b3 = MUL16(W7, col[8*1]);
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
185
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
186 MAC16(b0, + W3, col[8*3]);
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
187 MAC16(b1, - W7, col[8*3]);
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
188 MAC16(b2, - W1, col[8*3]);
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
189 MAC16(b3, - W5, col[8*3]);
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
190
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
191 if(col[8*4]){
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
192 a0 += + W4*col[8*4];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
193 a1 += - W4*col[8*4];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
194 a2 += - W4*col[8*4];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
195 a3 += + W4*col[8*4];
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
196 }
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
197
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
198 if (col[8*5]) {
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
199 MAC16(b0, + W5, col[8*5]);
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
200 MAC16(b1, - W1, col[8*5]);
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
201 MAC16(b2, + W7, col[8*5]);
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
202 MAC16(b3, + W3, col[8*5]);
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
203 }
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
204
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
205 if(col[8*6]){
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
206 a0 += + W6*col[8*6];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
207 a1 += - W2*col[8*6];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
208 a2 += + W2*col[8*6];
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
209 a3 += - W6*col[8*6];
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
210 }
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
211
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
212 if (col[8*7]) {
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
213 MAC16(b0, + W7, col[8*7]);
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
214 MAC16(b1, - W5, col[8*7]);
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
215 MAC16(b2, + W3, col[8*7]);
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
216 MAC16(b3, - W1, col[8*7]);
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
217 }
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
218
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
219 dest[0] = cm[(a0 + b0) >> COL_SHIFT];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
220 dest += line_size;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
221 dest[0] = cm[(a1 + b1) >> COL_SHIFT];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
222 dest += line_size;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
223 dest[0] = cm[(a2 + b2) >> COL_SHIFT];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
224 dest += line_size;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
225 dest[0] = cm[(a3 + b3) >> COL_SHIFT];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
226 dest += line_size;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
227 dest[0] = cm[(a3 - b3) >> COL_SHIFT];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
228 dest += line_size;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
229 dest[0] = cm[(a2 - b2) >> COL_SHIFT];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
230 dest += line_size;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
231 dest[0] = cm[(a1 - b1) >> COL_SHIFT];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
232 dest += line_size;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
233 dest[0] = cm[(a0 - b0) >> COL_SHIFT];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
234 }
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
235
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1106
diff changeset
236 static inline void idctSparseColAdd (uint8_t *dest, int line_size,
1008
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
237 DCTELEM * col)
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
238 {
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
239 int a0, a1, a2, a3, b0, b1, b2, b3;
4176
23da44e8fd05 rename cropTbl -> ff_cropTbl
mru
parents: 3947
diff changeset
240 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
241
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
242 /* XXX: I did that only to give same values as previous code */
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
243 a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
244 a1 = a0;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
245 a2 = a0;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
246 a3 = a0;
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
247
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
248 a0 += + W2*col[8*2];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
249 a1 += + W6*col[8*2];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
250 a2 += - W6*col[8*2];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
251 a3 += - W2*col[8*2];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
252
8497
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
253 b0 = MUL16(W1, col[8*1]);
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
254 b1 = MUL16(W3, col[8*1]);
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
255 b2 = MUL16(W5, col[8*1]);
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
256 b3 = MUL16(W7, col[8*1]);
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
257
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
258 MAC16(b0, + W3, col[8*3]);
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
259 MAC16(b1, - W7, col[8*3]);
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
260 MAC16(b2, - W1, col[8*3]);
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
261 MAC16(b3, - W5, col[8*3]);
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
262
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
263 if(col[8*4]){
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
264 a0 += + W4*col[8*4];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
265 a1 += - W4*col[8*4];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
266 a2 += - W4*col[8*4];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
267 a3 += + W4*col[8*4];
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
268 }
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
269
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
270 if (col[8*5]) {
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
271 MAC16(b0, + W5, col[8*5]);
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
272 MAC16(b1, - W1, col[8*5]);
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
273 MAC16(b2, + W7, col[8*5]);
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
274 MAC16(b3, + W3, col[8*5]);
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
275 }
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
276
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
277 if(col[8*6]){
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
278 a0 += + W6*col[8*6];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
279 a1 += - W2*col[8*6];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
280 a2 += + W2*col[8*6];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
281 a3 += - W6*col[8*6];
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
282 }
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
283
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
284 if (col[8*7]) {
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
285 MAC16(b0, + W7, col[8*7]);
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
286 MAC16(b1, - W5, col[8*7]);
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
287 MAC16(b2, + W3, col[8*7]);
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
288 MAC16(b3, - W1, col[8*7]);
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
289 }
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
290
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
291 dest[0] = cm[dest[0] + ((a0 + b0) >> COL_SHIFT)];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
292 dest += line_size;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
293 dest[0] = cm[dest[0] + ((a1 + b1) >> COL_SHIFT)];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
294 dest += line_size;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
295 dest[0] = cm[dest[0] + ((a2 + b2) >> COL_SHIFT)];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
296 dest += line_size;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
297 dest[0] = cm[dest[0] + ((a3 + b3) >> COL_SHIFT)];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
298 dest += line_size;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
299 dest[0] = cm[dest[0] + ((a3 - b3) >> COL_SHIFT)];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
300 dest += line_size;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
301 dest[0] = cm[dest[0] + ((a2 - b2) >> COL_SHIFT)];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
302 dest += line_size;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
303 dest[0] = cm[dest[0] + ((a1 - b1) >> COL_SHIFT)];
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
304 dest += line_size;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
305 dest[0] = cm[dest[0] + ((a0 - b0) >> COL_SHIFT)];
175
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
306 }
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
307
1008
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
308 static inline void idctSparseCol (DCTELEM * col)
633
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
309 {
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
310 int a0, a1, a2, a3, b0, b1, b2, b3;
633
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
311
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
312 /* XXX: I did that only to give same values as previous code */
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
313 a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
314 a1 = a0;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
315 a2 = a0;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
316 a3 = a0;
633
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
317
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
318 a0 += + W2*col[8*2];
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
319 a1 += + W6*col[8*2];
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
320 a2 += - W6*col[8*2];
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
321 a3 += - W2*col[8*2];
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
322
8497
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
323 b0 = MUL16(W1, col[8*1]);
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
324 b1 = MUL16(W3, col[8*1]);
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
325 b2 = MUL16(W5, col[8*1]);
927f0ee6e4ad simple_idct: use MUL16 and MAC16 from mathops.h
mru
parents: 8496
diff changeset
326 b3 = MUL16(W7, col[8*1]);
633
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
327
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
328 MAC16(b0, + W3, col[8*3]);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
329 MAC16(b1, - W7, col[8*3]);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
330 MAC16(b2, - W1, col[8*3]);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
331 MAC16(b3, - W5, col[8*3]);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
332
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
333 if(col[8*4]){
633
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
334 a0 += + W4*col[8*4];
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
335 a1 += - W4*col[8*4];
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
336 a2 += - W4*col[8*4];
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
337 a3 += + W4*col[8*4];
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
338 }
633
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
339
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
340 if (col[8*5]) {
633
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
341 MAC16(b0, + W5, col[8*5]);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
342 MAC16(b1, - W1, col[8*5]);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
343 MAC16(b2, + W7, col[8*5]);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
344 MAC16(b3, + W3, col[8*5]);
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
345 }
633
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
346
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
347 if(col[8*6]){
633
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
348 a0 += + W6*col[8*6];
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
349 a1 += - W2*col[8*6];
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
350 a2 += + W2*col[8*6];
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
351 a3 += - W6*col[8*6];
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
352 }
633
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
353
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
354 if (col[8*7]) {
633
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
355 MAC16(b0, + W7, col[8*7]);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
356 MAC16(b1, - W5, col[8*7]);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
357 MAC16(b2, + W3, col[8*7]);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
358 MAC16(b3, - W1, col[8*7]);
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
359 }
633
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
360
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
361 col[0 ] = ((a0 + b0) >> COL_SHIFT);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
362 col[8 ] = ((a1 + b1) >> COL_SHIFT);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
363 col[16] = ((a2 + b2) >> COL_SHIFT);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
364 col[24] = ((a3 + b3) >> COL_SHIFT);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
365 col[32] = ((a3 - b3) >> COL_SHIFT);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
366 col[40] = ((a2 - b2) >> COL_SHIFT);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
367 col[48] = ((a1 - b1) >> COL_SHIFT);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
368 col[56] = ((a0 - b0) >> COL_SHIFT);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
369 }
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
370
6001
f4859c13426b add ff_ prefix to all simple_idct symbols
aurel
parents: 5978
diff changeset
371 void ff_simple_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
372 {
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
373 int i;
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
374 for(i=0; i<8; i++)
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
375 idctRowCondDC(block + i*8);
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1106
diff changeset
376
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
377 for(i=0; i<8; i++)
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
378 idctSparseColPut(dest + i, line_size, block + i);
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
379 }
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
380
6001
f4859c13426b add ff_ prefix to all simple_idct symbols
aurel
parents: 5978
diff changeset
381 void ff_simple_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
382 {
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
383 int i;
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
384 for(i=0; i<8; i++)
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
385 idctRowCondDC(block + i*8);
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1106
diff changeset
386
479
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
387 for(i=0; i<8; i++)
40ffce2cb6ef added inlined put/add functions
bellard
parents: 476
diff changeset
388 idctSparseColAdd(dest + i, line_size, block + i);
476
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
389 }
ec13b0a726c3 removed unused code - began to merge alpha specific stuff - added mac macros for suitable CPUs
bellard
parents: 464
diff changeset
390
6001
f4859c13426b add ff_ prefix to all simple_idct symbols
aurel
parents: 5978
diff changeset
391 void ff_simple_idct(DCTELEM *block)
633
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
392 {
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
393 int i;
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
394 for(i=0; i<8; i++)
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
395 idctRowCondDC(block + i*8);
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1106
diff changeset
396
633
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
397 for(i=0; i<8; i++)
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
398 idctSparseCol(block + i);
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
399 }
e7b72c1dfa1b dct-test update
michaelni
parents: 503
diff changeset
400
719
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
401 /* 2x4x8 idct */
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
402
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
403 #define CN_SHIFT 12
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
404 #define C_FIX(x) ((int)((x) * (1 << CN_SHIFT) + 0.5))
722
ff90043f4a2d in fact IDCT248 needs to be normalized as I suspected
bellard
parents: 719
diff changeset
405 #define C1 C_FIX(0.6532814824)
ff90043f4a2d in fact IDCT248 needs to be normalized as I suspected
bellard
parents: 719
diff changeset
406 #define C2 C_FIX(0.2705980501)
719
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
407
722
ff90043f4a2d in fact IDCT248 needs to be normalized as I suspected
bellard
parents: 719
diff changeset
408 /* row idct is multiple by 16 * sqrt(2.0), col idct4 is normalized,
ff90043f4a2d in fact IDCT248 needs to be normalized as I suspected
bellard
parents: 719
diff changeset
409 and the butterfly must be multiplied by 0.5 * sqrt(2.0) */
ff90043f4a2d in fact IDCT248 needs to be normalized as I suspected
bellard
parents: 719
diff changeset
410 #define C_SHIFT (4+1+12)
719
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
411
5978
eb2b4b1da4cd Rename function to reflect its action
kostya
parents: 4603
diff changeset
412 static inline void idct4col_put(uint8_t *dest, int line_size, const DCTELEM *col)
719
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
413 {
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
414 int c0, c1, c2, c3, a0, a1, a2, a3;
4176
23da44e8fd05 rename cropTbl -> ff_cropTbl
mru
parents: 3947
diff changeset
415 const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
719
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
416
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
417 a0 = col[8*0];
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
418 a1 = col[8*2];
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
419 a2 = col[8*4];
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
420 a3 = col[8*6];
722
ff90043f4a2d in fact IDCT248 needs to be normalized as I suspected
bellard
parents: 719
diff changeset
421 c0 = ((a0 + a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1));
ff90043f4a2d in fact IDCT248 needs to be normalized as I suspected
bellard
parents: 719
diff changeset
422 c2 = ((a0 - a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1));
719
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
423 c1 = a1 * C1 + a3 * C2;
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
424 c3 = a1 * C2 - a3 * C1;
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
425 dest[0] = cm[(c0 + c1) >> C_SHIFT];
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
426 dest += line_size;
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
427 dest[0] = cm[(c2 + c3) >> C_SHIFT];
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
428 dest += line_size;
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
429 dest[0] = cm[(c2 - c3) >> C_SHIFT];
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
430 dest += line_size;
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
431 dest[0] = cm[(c0 - c1) >> C_SHIFT];
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
432 }
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
433
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
434 #define BF(k) \
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
435 {\
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
436 int a0, a1;\
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
437 a0 = ptr[k];\
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
438 a1 = ptr[8 + k];\
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
439 ptr[k] = a0 + a1;\
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
440 ptr[8 + k] = a0 - a1;\
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
441 }
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
442
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
443 /* only used by DV codec. The input must be interlaced. 128 is added
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
444 to the pixels before clamping to avoid systematic error
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
445 (1024*sqrt(2)) offset would be needed otherwise. */
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
446 /* XXX: I think a 1.0/sqrt(2) normalization should be needed to
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
447 compensate the extra butterfly stage - I don't have the full DV
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
448 specification */
6001
f4859c13426b add ff_ prefix to all simple_idct symbols
aurel
parents: 5978
diff changeset
449 void ff_simple_idct248_put(uint8_t *dest, int line_size, DCTELEM *block)
719
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
450 {
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
451 int i;
1008
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
452 DCTELEM *ptr;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1106
diff changeset
453
719
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
454 /* butterfly */
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
455 ptr = block;
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
456 for(i=0;i<4;i++) {
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
457 BF(0);
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
458 BF(1);
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
459 BF(2);
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
460 BF(3);
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
461 BF(4);
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
462 BF(5);
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
463 BF(6);
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
464 BF(7);
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
465 ptr += 2 * 8;
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
466 }
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
467
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
468 /* IDCT8 on each line */
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
469 for(i=0; i<8; i++) {
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
470 idctRowCondDC(block + i*8);
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
471 }
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
472
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
473 /* IDCT4 and store */
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
474 for(i=0;i<8;i++) {
5978
eb2b4b1da4cd Rename function to reflect its action
kostya
parents: 4603
diff changeset
475 idct4col_put(dest + i, 2 * line_size, block + i);
eb2b4b1da4cd Rename function to reflect its action
kostya
parents: 4603
diff changeset
476 idct4col_put(dest + line_size + i, 2 * line_size, block + 8 + i);
719
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
477 }
2b7ff6dfee35 first version of IDCT248 for DV decoding support
bellard
parents: 642
diff changeset
478 }
936
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
479
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
480 /* 8x4 & 4x8 WMV2 IDCT */
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
481 #undef CN_SHIFT
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
482 #undef C_SHIFT
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
483 #undef C_FIX
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
484 #undef C1
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
485 #undef C2
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
486 #define CN_SHIFT 12
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
487 #define C_FIX(x) ((int)((x) * 1.414213562 * (1 << CN_SHIFT) + 0.5))
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
488 #define C1 C_FIX(0.6532814824)
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
489 #define C2 C_FIX(0.2705980501)
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
490 #define C3 C_FIX(0.5)
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
491 #define C_SHIFT (4+1+12)
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1008
diff changeset
492 static inline void idct4col_add(uint8_t *dest, int line_size, const DCTELEM *col)
936
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
493 {
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
494 int c0, c1, c2, c3, a0, a1, a2, a3;
4176
23da44e8fd05 rename cropTbl -> ff_cropTbl
mru
parents: 3947
diff changeset
495 const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
936
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
496
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
497 a0 = col[8*0];
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
498 a1 = col[8*1];
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
499 a2 = col[8*2];
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
500 a3 = col[8*3];
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
501 c0 = (a0 + a2)*C3 + (1 << (C_SHIFT - 1));
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
502 c2 = (a0 - a2)*C3 + (1 << (C_SHIFT - 1));
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
503 c1 = a1 * C1 + a3 * C2;
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
504 c3 = a1 * C2 - a3 * C1;
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
505 dest[0] = cm[dest[0] + ((c0 + c1) >> C_SHIFT)];
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
506 dest += line_size;
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
507 dest[0] = cm[dest[0] + ((c2 + c3) >> C_SHIFT)];
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
508 dest += line_size;
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
509 dest[0] = cm[dest[0] + ((c2 - c3) >> C_SHIFT)];
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
510 dest += line_size;
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
511 dest[0] = cm[dest[0] + ((c0 - c1) >> C_SHIFT)];
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
512 }
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
513
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
514 #define RN_SHIFT 15
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
515 #define R_FIX(x) ((int)((x) * 1.414213562 * (1 << RN_SHIFT) + 0.5))
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
516 #define R1 R_FIX(0.6532814824)
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
517 #define R2 R_FIX(0.2705980501)
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
518 #define R3 R_FIX(0.5)
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
519 #define R_SHIFT 11
1008
fb6cbb8a04a3 fixing DCTELEM != short
michaelni
parents: 936
diff changeset
520 static inline void idct4row(DCTELEM *row)
936
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
521 {
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
522 int c0, c1, c2, c3, a0, a1, a2, a3;
4176
23da44e8fd05 rename cropTbl -> ff_cropTbl
mru
parents: 3947
diff changeset
523 //const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
936
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
524
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
525 a0 = row[0];
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
526 a1 = row[1];
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
527 a2 = row[2];
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
528 a3 = row[3];
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
529 c0 = (a0 + a2)*R3 + (1 << (R_SHIFT - 1));
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
530 c2 = (a0 - a2)*R3 + (1 << (R_SHIFT - 1));
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
531 c1 = a1 * R1 + a3 * R2;
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
532 c3 = a1 * R2 - a3 * R1;
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
533 row[0]= (c0 + c1) >> R_SHIFT;
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
534 row[1]= (c2 + c3) >> R_SHIFT;
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
535 row[2]= (c2 - c3) >> R_SHIFT;
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
536 row[3]= (c0 - c1) >> R_SHIFT;
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
537 }
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
538
6001
f4859c13426b add ff_ prefix to all simple_idct symbols
aurel
parents: 5978
diff changeset
539 void ff_simple_idct84_add(uint8_t *dest, int line_size, DCTELEM *block)
936
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
540 {
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
541 int i;
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
542
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
543 /* IDCT8 on each line */
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
544 for(i=0; i<4; i++) {
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
545 idctRowCondDC(block + i*8);
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
546 }
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
547
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
548 /* IDCT4 and store */
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
549 for(i=0;i<8;i++) {
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
550 idct4col_add(dest + i, line_size, block + i);
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
551 }
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
552 }
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
553
6001
f4859c13426b add ff_ prefix to all simple_idct symbols
aurel
parents: 5978
diff changeset
554 void ff_simple_idct48_add(uint8_t *dest, int line_size, DCTELEM *block)
936
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
555 {
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
556 int i;
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
557
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
558 /* IDCT4 on each line */
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
559 for(i=0; i<8; i++) {
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
560 idct4row(block + i*8);
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
561 }
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
562
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
563 /* IDCT8 and store */
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
564 for(i=0; i<4; i++){
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
565 idctSparseColAdd(dest + i, line_size, block + i);
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
566 }
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
567 }
caa77cd960c0 qpel encoding
michaelni
parents: 744
diff changeset
568
6007
3c37faa04193 Add 4x4 IDCT
kostya
parents: 6001
diff changeset
569 void ff_simple_idct44_add(uint8_t *dest, int line_size, DCTELEM *block)
3c37faa04193 Add 4x4 IDCT
kostya
parents: 6001
diff changeset
570 {
3c37faa04193 Add 4x4 IDCT
kostya
parents: 6001
diff changeset
571 int i;
3c37faa04193 Add 4x4 IDCT
kostya
parents: 6001
diff changeset
572
3c37faa04193 Add 4x4 IDCT
kostya
parents: 6001
diff changeset
573 /* IDCT4 on each line */
3c37faa04193 Add 4x4 IDCT
kostya
parents: 6001
diff changeset
574 for(i=0; i<4; i++) {
3c37faa04193 Add 4x4 IDCT
kostya
parents: 6001
diff changeset
575 idct4row(block + i*8);
3c37faa04193 Add 4x4 IDCT
kostya
parents: 6001
diff changeset
576 }
3c37faa04193 Add 4x4 IDCT
kostya
parents: 6001
diff changeset
577
3c37faa04193 Add 4x4 IDCT
kostya
parents: 6001
diff changeset
578 /* IDCT4 and store */
3c37faa04193 Add 4x4 IDCT
kostya
parents: 6001
diff changeset
579 for(i=0; i<4; i++){
3c37faa04193 Add 4x4 IDCT
kostya
parents: 6001
diff changeset
580 idct4col_add(dest + i, line_size, block + i);
3c37faa04193 Add 4x4 IDCT
kostya
parents: 6001
diff changeset
581 }
3c37faa04193 Add 4x4 IDCT
kostya
parents: 6001
diff changeset
582 }