simple_idct.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. /*
  2. * Simple IDCT
  3. *
  4. * Copyright (c) 2001 Michael Niedermayer <michaelni@gmx.at>
  5. *
  6. * This file is part of FFmpeg.
  7. *
  8. * FFmpeg is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * FFmpeg is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with FFmpeg; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. /**
  23. * @file libavcodec/simple_idct.c
  24. * simpleidct in C.
  25. */
  26. /*
  27. based upon some outcommented c code from mpeg2dec (idct_mmx.c
  28. written by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>)
  29. */
  30. #include "avcodec.h"
  31. #include "dsputil.h"
  32. #include "mathops.h"
  33. #include "simple_idct.h"
  34. #if 0
  35. #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */
  36. #define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */
  37. #define W3 2408 /* 2048*sqrt (2)*cos (3*pi/16) */
  38. #define W4 2048 /* 2048*sqrt (2)*cos (4*pi/16) */
  39. #define W5 1609 /* 2048*sqrt (2)*cos (5*pi/16) */
  40. #define W6 1108 /* 2048*sqrt (2)*cos (6*pi/16) */
  41. #define W7 565 /* 2048*sqrt (2)*cos (7*pi/16) */
  42. #define ROW_SHIFT 8
  43. #define COL_SHIFT 17
  44. #else
  45. #define W1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
  46. #define W2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
  47. #define W3 19266 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
  48. #define W4 16383 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
  49. #define W5 12873 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
  50. #define W6 8867 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
  51. #define W7 4520 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
  52. #define ROW_SHIFT 11
  53. #define COL_SHIFT 20 // 6
  54. #endif
  55. static inline void idctRowCondDC (DCTELEM * row)
  56. {
  57. int a0, a1, a2, a3, b0, b1, b2, b3;
  58. #if HAVE_FAST_64BIT
  59. uint64_t temp;
  60. #else
  61. uint32_t temp;
  62. #endif
  63. #if HAVE_FAST_64BIT
  64. #ifdef WORDS_BIGENDIAN
  65. #define ROW0_MASK 0xffff000000000000LL
  66. #else
  67. #define ROW0_MASK 0xffffLL
  68. #endif
  69. if(sizeof(DCTELEM)==2){
  70. if ( ((((uint64_t *)row)[0] & ~ROW0_MASK) |
  71. ((uint64_t *)row)[1]) == 0) {
  72. temp = (row[0] << 3) & 0xffff;
  73. temp += temp << 16;
  74. temp += temp << 32;
  75. ((uint64_t *)row)[0] = temp;
  76. ((uint64_t *)row)[1] = temp;
  77. return;
  78. }
  79. }else{
  80. if (!(row[1]|row[2]|row[3]|row[4]|row[5]|row[6]|row[7])) {
  81. row[0]=row[1]=row[2]=row[3]=row[4]=row[5]=row[6]=row[7]= row[0] << 3;
  82. return;
  83. }
  84. }
  85. #else
  86. if(sizeof(DCTELEM)==2){
  87. if (!(((uint32_t*)row)[1] |
  88. ((uint32_t*)row)[2] |
  89. ((uint32_t*)row)[3] |
  90. row[1])) {
  91. temp = (row[0] << 3) & 0xffff;
  92. temp += temp << 16;
  93. ((uint32_t*)row)[0]=((uint32_t*)row)[1] =
  94. ((uint32_t*)row)[2]=((uint32_t*)row)[3] = temp;
  95. return;
  96. }
  97. }else{
  98. if (!(row[1]|row[2]|row[3]|row[4]|row[5]|row[6]|row[7])) {
  99. row[0]=row[1]=row[2]=row[3]=row[4]=row[5]=row[6]=row[7]= row[0] << 3;
  100. return;
  101. }
  102. }
  103. #endif
  104. a0 = (W4 * row[0]) + (1 << (ROW_SHIFT - 1));
  105. a1 = a0;
  106. a2 = a0;
  107. a3 = a0;
  108. /* no need to optimize : gcc does it */
  109. a0 += W2 * row[2];
  110. a1 += W6 * row[2];
  111. a2 -= W6 * row[2];
  112. a3 -= W2 * row[2];
  113. b0 = MUL16(W1, row[1]);
  114. MAC16(b0, W3, row[3]);
  115. b1 = MUL16(W3, row[1]);
  116. MAC16(b1, -W7, row[3]);
  117. b2 = MUL16(W5, row[1]);
  118. MAC16(b2, -W1, row[3]);
  119. b3 = MUL16(W7, row[1]);
  120. MAC16(b3, -W5, row[3]);
  121. #if HAVE_FAST_64BIT
  122. temp = ((uint64_t*)row)[1];
  123. #else
  124. temp = ((uint32_t*)row)[2] | ((uint32_t*)row)[3];
  125. #endif
  126. if (temp != 0) {
  127. a0 += W4*row[4] + W6*row[6];
  128. a1 += - W4*row[4] - W2*row[6];
  129. a2 += - W4*row[4] + W2*row[6];
  130. a3 += W4*row[4] - W6*row[6];
  131. MAC16(b0, W5, row[5]);
  132. MAC16(b0, W7, row[7]);
  133. MAC16(b1, -W1, row[5]);
  134. MAC16(b1, -W5, row[7]);
  135. MAC16(b2, W7, row[5]);
  136. MAC16(b2, W3, row[7]);
  137. MAC16(b3, W3, row[5]);
  138. MAC16(b3, -W1, row[7]);
  139. }
  140. row[0] = (a0 + b0) >> ROW_SHIFT;
  141. row[7] = (a0 - b0) >> ROW_SHIFT;
  142. row[1] = (a1 + b1) >> ROW_SHIFT;
  143. row[6] = (a1 - b1) >> ROW_SHIFT;
  144. row[2] = (a2 + b2) >> ROW_SHIFT;
  145. row[5] = (a2 - b2) >> ROW_SHIFT;
  146. row[3] = (a3 + b3) >> ROW_SHIFT;
  147. row[4] = (a3 - b3) >> ROW_SHIFT;
  148. }
  149. static inline void idctSparseColPut (uint8_t *dest, int line_size,
  150. DCTELEM * col)
  151. {
  152. int a0, a1, a2, a3, b0, b1, b2, b3;
  153. uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
  154. /* XXX: I did that only to give same values as previous code */
  155. a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
  156. a1 = a0;
  157. a2 = a0;
  158. a3 = a0;
  159. a0 += + W2*col[8*2];
  160. a1 += + W6*col[8*2];
  161. a2 += - W6*col[8*2];
  162. a3 += - W2*col[8*2];
  163. b0 = MUL16(W1, col[8*1]);
  164. b1 = MUL16(W3, col[8*1]);
  165. b2 = MUL16(W5, col[8*1]);
  166. b3 = MUL16(W7, col[8*1]);
  167. MAC16(b0, + W3, col[8*3]);
  168. MAC16(b1, - W7, col[8*3]);
  169. MAC16(b2, - W1, col[8*3]);
  170. MAC16(b3, - W5, col[8*3]);
  171. if(col[8*4]){
  172. a0 += + W4*col[8*4];
  173. a1 += - W4*col[8*4];
  174. a2 += - W4*col[8*4];
  175. a3 += + W4*col[8*4];
  176. }
  177. if (col[8*5]) {
  178. MAC16(b0, + W5, col[8*5]);
  179. MAC16(b1, - W1, col[8*5]);
  180. MAC16(b2, + W7, col[8*5]);
  181. MAC16(b3, + W3, col[8*5]);
  182. }
  183. if(col[8*6]){
  184. a0 += + W6*col[8*6];
  185. a1 += - W2*col[8*6];
  186. a2 += + W2*col[8*6];
  187. a3 += - W6*col[8*6];
  188. }
  189. if (col[8*7]) {
  190. MAC16(b0, + W7, col[8*7]);
  191. MAC16(b1, - W5, col[8*7]);
  192. MAC16(b2, + W3, col[8*7]);
  193. MAC16(b3, - W1, col[8*7]);
  194. }
  195. dest[0] = cm[(a0 + b0) >> COL_SHIFT];
  196. dest += line_size;
  197. dest[0] = cm[(a1 + b1) >> COL_SHIFT];
  198. dest += line_size;
  199. dest[0] = cm[(a2 + b2) >> COL_SHIFT];
  200. dest += line_size;
  201. dest[0] = cm[(a3 + b3) >> COL_SHIFT];
  202. dest += line_size;
  203. dest[0] = cm[(a3 - b3) >> COL_SHIFT];
  204. dest += line_size;
  205. dest[0] = cm[(a2 - b2) >> COL_SHIFT];
  206. dest += line_size;
  207. dest[0] = cm[(a1 - b1) >> COL_SHIFT];
  208. dest += line_size;
  209. dest[0] = cm[(a0 - b0) >> COL_SHIFT];
  210. }
  211. static inline void idctSparseColAdd (uint8_t *dest, int line_size,
  212. DCTELEM * col)
  213. {
  214. int a0, a1, a2, a3, b0, b1, b2, b3;
  215. uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
  216. /* XXX: I did that only to give same values as previous code */
  217. a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
  218. a1 = a0;
  219. a2 = a0;
  220. a3 = a0;
  221. a0 += + W2*col[8*2];
  222. a1 += + W6*col[8*2];
  223. a2 += - W6*col[8*2];
  224. a3 += - W2*col[8*2];
  225. b0 = MUL16(W1, col[8*1]);
  226. b1 = MUL16(W3, col[8*1]);
  227. b2 = MUL16(W5, col[8*1]);
  228. b3 = MUL16(W7, col[8*1]);
  229. MAC16(b0, + W3, col[8*3]);
  230. MAC16(b1, - W7, col[8*3]);
  231. MAC16(b2, - W1, col[8*3]);
  232. MAC16(b3, - W5, col[8*3]);
  233. if(col[8*4]){
  234. a0 += + W4*col[8*4];
  235. a1 += - W4*col[8*4];
  236. a2 += - W4*col[8*4];
  237. a3 += + W4*col[8*4];
  238. }
  239. if (col[8*5]) {
  240. MAC16(b0, + W5, col[8*5]);
  241. MAC16(b1, - W1, col[8*5]);
  242. MAC16(b2, + W7, col[8*5]);
  243. MAC16(b3, + W3, col[8*5]);
  244. }
  245. if(col[8*6]){
  246. a0 += + W6*col[8*6];
  247. a1 += - W2*col[8*6];
  248. a2 += + W2*col[8*6];
  249. a3 += - W6*col[8*6];
  250. }
  251. if (col[8*7]) {
  252. MAC16(b0, + W7, col[8*7]);
  253. MAC16(b1, - W5, col[8*7]);
  254. MAC16(b2, + W3, col[8*7]);
  255. MAC16(b3, - W1, col[8*7]);
  256. }
  257. dest[0] = cm[dest[0] + ((a0 + b0) >> COL_SHIFT)];
  258. dest += line_size;
  259. dest[0] = cm[dest[0] + ((a1 + b1) >> COL_SHIFT)];
  260. dest += line_size;
  261. dest[0] = cm[dest[0] + ((a2 + b2) >> COL_SHIFT)];
  262. dest += line_size;
  263. dest[0] = cm[dest[0] + ((a3 + b3) >> COL_SHIFT)];
  264. dest += line_size;
  265. dest[0] = cm[dest[0] + ((a3 - b3) >> COL_SHIFT)];
  266. dest += line_size;
  267. dest[0] = cm[dest[0] + ((a2 - b2) >> COL_SHIFT)];
  268. dest += line_size;
  269. dest[0] = cm[dest[0] + ((a1 - b1) >> COL_SHIFT)];
  270. dest += line_size;
  271. dest[0] = cm[dest[0] + ((a0 - b0) >> COL_SHIFT)];
  272. }
  273. static inline void idctSparseCol (DCTELEM * col)
  274. {
  275. int a0, a1, a2, a3, b0, b1, b2, b3;
  276. /* XXX: I did that only to give same values as previous code */
  277. a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
  278. a1 = a0;
  279. a2 = a0;
  280. a3 = a0;
  281. a0 += + W2*col[8*2];
  282. a1 += + W6*col[8*2];
  283. a2 += - W6*col[8*2];
  284. a3 += - W2*col[8*2];
  285. b0 = MUL16(W1, col[8*1]);
  286. b1 = MUL16(W3, col[8*1]);
  287. b2 = MUL16(W5, col[8*1]);
  288. b3 = MUL16(W7, col[8*1]);
  289. MAC16(b0, + W3, col[8*3]);
  290. MAC16(b1, - W7, col[8*3]);
  291. MAC16(b2, - W1, col[8*3]);
  292. MAC16(b3, - W5, col[8*3]);
  293. if(col[8*4]){
  294. a0 += + W4*col[8*4];
  295. a1 += - W4*col[8*4];
  296. a2 += - W4*col[8*4];
  297. a3 += + W4*col[8*4];
  298. }
  299. if (col[8*5]) {
  300. MAC16(b0, + W5, col[8*5]);
  301. MAC16(b1, - W1, col[8*5]);
  302. MAC16(b2, + W7, col[8*5]);
  303. MAC16(b3, + W3, col[8*5]);
  304. }
  305. if(col[8*6]){
  306. a0 += + W6*col[8*6];
  307. a1 += - W2*col[8*6];
  308. a2 += + W2*col[8*6];
  309. a3 += - W6*col[8*6];
  310. }
  311. if (col[8*7]) {
  312. MAC16(b0, + W7, col[8*7]);
  313. MAC16(b1, - W5, col[8*7]);
  314. MAC16(b2, + W3, col[8*7]);
  315. MAC16(b3, - W1, col[8*7]);
  316. }
  317. col[0 ] = ((a0 + b0) >> COL_SHIFT);
  318. col[8 ] = ((a1 + b1) >> COL_SHIFT);
  319. col[16] = ((a2 + b2) >> COL_SHIFT);
  320. col[24] = ((a3 + b3) >> COL_SHIFT);
  321. col[32] = ((a3 - b3) >> COL_SHIFT);
  322. col[40] = ((a2 - b2) >> COL_SHIFT);
  323. col[48] = ((a1 - b1) >> COL_SHIFT);
  324. col[56] = ((a0 - b0) >> COL_SHIFT);
  325. }
  326. void ff_simple_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
  327. {
  328. int i;
  329. for(i=0; i<8; i++)
  330. idctRowCondDC(block + i*8);
  331. for(i=0; i<8; i++)
  332. idctSparseColPut(dest + i, line_size, block + i);
  333. }
  334. void ff_simple_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
  335. {
  336. int i;
  337. for(i=0; i<8; i++)
  338. idctRowCondDC(block + i*8);
  339. for(i=0; i<8; i++)
  340. idctSparseColAdd(dest + i, line_size, block + i);
  341. }
  342. void ff_simple_idct(DCTELEM *block)
  343. {
  344. int i;
  345. for(i=0; i<8; i++)
  346. idctRowCondDC(block + i*8);
  347. for(i=0; i<8; i++)
  348. idctSparseCol(block + i);
  349. }
  350. /* 2x4x8 idct */
  351. #define CN_SHIFT 12
  352. #define C_FIX(x) ((int)((x) * (1 << CN_SHIFT) + 0.5))
  353. #define C1 C_FIX(0.6532814824)
  354. #define C2 C_FIX(0.2705980501)
  355. /* row idct is multiple by 16 * sqrt(2.0), col idct4 is normalized,
  356. and the butterfly must be multiplied by 0.5 * sqrt(2.0) */
  357. #define C_SHIFT (4+1+12)
  358. static inline void idct4col_put(uint8_t *dest, int line_size, const DCTELEM *col)
  359. {
  360. int c0, c1, c2, c3, a0, a1, a2, a3;
  361. const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
  362. a0 = col[8*0];
  363. a1 = col[8*2];
  364. a2 = col[8*4];
  365. a3 = col[8*6];
  366. c0 = ((a0 + a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1));
  367. c2 = ((a0 - a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1));
  368. c1 = a1 * C1 + a3 * C2;
  369. c3 = a1 * C2 - a3 * C1;
  370. dest[0] = cm[(c0 + c1) >> C_SHIFT];
  371. dest += line_size;
  372. dest[0] = cm[(c2 + c3) >> C_SHIFT];
  373. dest += line_size;
  374. dest[0] = cm[(c2 - c3) >> C_SHIFT];
  375. dest += line_size;
  376. dest[0] = cm[(c0 - c1) >> C_SHIFT];
  377. }
  378. #define BF(k) \
  379. {\
  380. int a0, a1;\
  381. a0 = ptr[k];\
  382. a1 = ptr[8 + k];\
  383. ptr[k] = a0 + a1;\
  384. ptr[8 + k] = a0 - a1;\
  385. }
  386. /* only used by DV codec. The input must be interlaced. 128 is added
  387. to the pixels before clamping to avoid systematic error
  388. (1024*sqrt(2)) offset would be needed otherwise. */
  389. /* XXX: I think a 1.0/sqrt(2) normalization should be needed to
  390. compensate the extra butterfly stage - I don't have the full DV
  391. specification */
  392. void ff_simple_idct248_put(uint8_t *dest, int line_size, DCTELEM *block)
  393. {
  394. int i;
  395. DCTELEM *ptr;
  396. /* butterfly */
  397. ptr = block;
  398. for(i=0;i<4;i++) {
  399. BF(0);
  400. BF(1);
  401. BF(2);
  402. BF(3);
  403. BF(4);
  404. BF(5);
  405. BF(6);
  406. BF(7);
  407. ptr += 2 * 8;
  408. }
  409. /* IDCT8 on each line */
  410. for(i=0; i<8; i++) {
  411. idctRowCondDC(block + i*8);
  412. }
  413. /* IDCT4 and store */
  414. for(i=0;i<8;i++) {
  415. idct4col_put(dest + i, 2 * line_size, block + i);
  416. idct4col_put(dest + line_size + i, 2 * line_size, block + 8 + i);
  417. }
  418. }
  419. /* 8x4 & 4x8 WMV2 IDCT */
  420. #undef CN_SHIFT
  421. #undef C_SHIFT
  422. #undef C_FIX
  423. #undef C1
  424. #undef C2
  425. #define CN_SHIFT 12
  426. #define C_FIX(x) ((int)((x) * 1.414213562 * (1 << CN_SHIFT) + 0.5))
  427. #define C1 C_FIX(0.6532814824)
  428. #define C2 C_FIX(0.2705980501)
  429. #define C3 C_FIX(0.5)
  430. #define C_SHIFT (4+1+12)
  431. static inline void idct4col_add(uint8_t *dest, int line_size, const DCTELEM *col)
  432. {
  433. int c0, c1, c2, c3, a0, a1, a2, a3;
  434. const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
  435. a0 = col[8*0];
  436. a1 = col[8*1];
  437. a2 = col[8*2];
  438. a3 = col[8*3];
  439. c0 = (a0 + a2)*C3 + (1 << (C_SHIFT - 1));
  440. c2 = (a0 - a2)*C3 + (1 << (C_SHIFT - 1));
  441. c1 = a1 * C1 + a3 * C2;
  442. c3 = a1 * C2 - a3 * C1;
  443. dest[0] = cm[dest[0] + ((c0 + c1) >> C_SHIFT)];
  444. dest += line_size;
  445. dest[0] = cm[dest[0] + ((c2 + c3) >> C_SHIFT)];
  446. dest += line_size;
  447. dest[0] = cm[dest[0] + ((c2 - c3) >> C_SHIFT)];
  448. dest += line_size;
  449. dest[0] = cm[dest[0] + ((c0 - c1) >> C_SHIFT)];
  450. }
  451. #define RN_SHIFT 15
  452. #define R_FIX(x) ((int)((x) * 1.414213562 * (1 << RN_SHIFT) + 0.5))
  453. #define R1 R_FIX(0.6532814824)
  454. #define R2 R_FIX(0.2705980501)
  455. #define R3 R_FIX(0.5)
  456. #define R_SHIFT 11
  457. static inline void idct4row(DCTELEM *row)
  458. {
  459. int c0, c1, c2, c3, a0, a1, a2, a3;
  460. //const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
  461. a0 = row[0];
  462. a1 = row[1];
  463. a2 = row[2];
  464. a3 = row[3];
  465. c0 = (a0 + a2)*R3 + (1 << (R_SHIFT - 1));
  466. c2 = (a0 - a2)*R3 + (1 << (R_SHIFT - 1));
  467. c1 = a1 * R1 + a3 * R2;
  468. c3 = a1 * R2 - a3 * R1;
  469. row[0]= (c0 + c1) >> R_SHIFT;
  470. row[1]= (c2 + c3) >> R_SHIFT;
  471. row[2]= (c2 - c3) >> R_SHIFT;
  472. row[3]= (c0 - c1) >> R_SHIFT;
  473. }
  474. void ff_simple_idct84_add(uint8_t *dest, int line_size, DCTELEM *block)
  475. {
  476. int i;
  477. /* IDCT8 on each line */
  478. for(i=0; i<4; i++) {
  479. idctRowCondDC(block + i*8);
  480. }
  481. /* IDCT4 and store */
  482. for(i=0;i<8;i++) {
  483. idct4col_add(dest + i, line_size, block + i);
  484. }
  485. }
  486. void ff_simple_idct48_add(uint8_t *dest, int line_size, DCTELEM *block)
  487. {
  488. int i;
  489. /* IDCT4 on each line */
  490. for(i=0; i<8; i++) {
  491. idct4row(block + i*8);
  492. }
  493. /* IDCT8 and store */
  494. for(i=0; i<4; i++){
  495. idctSparseColAdd(dest + i, line_size, block + i);
  496. }
  497. }
  498. void ff_simple_idct44_add(uint8_t *dest, int line_size, DCTELEM *block)
  499. {
  500. int i;
  501. /* IDCT4 on each line */
  502. for(i=0; i<4; i++) {
  503. idct4row(block + i*8);
  504. }
  505. /* IDCT4 and store */
  506. for(i=0; i<4; i++){
  507. idct4col_add(dest + i, line_size, block + i);
  508. }
  509. }