OLD | NEW |
1 /* | 1 /* |
2 * reference discrete cosine transform (double precision) | 2 * reference discrete cosine transform (double precision) |
3 * Copyright (C) 2009 Dylan Yudaken | 3 * Copyright (C) 2009 Dylan Yudaken |
4 * | 4 * |
5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
6 * | 6 * |
7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
(...skipping 12 matching lines...) Expand all Loading... |
23 * @file libavcodec/dctref.c | 23 * @file libavcodec/dctref.c |
24 * reference discrete cosine transform (double precision) | 24 * reference discrete cosine transform (double precision) |
25 * | 25 * |
26 * @author Dylan Yudaken (dyudaken at gmail) | 26 * @author Dylan Yudaken (dyudaken at gmail) |
27 * | 27 * |
28 * @note This file could be optimized a lot, but is for | 28 * @note This file could be optimized a lot, but is for |
29 * reference and so readability is better. | 29 * reference and so readability is better. |
30 */ | 30 */ |
31 | 31 |
32 #include "libavutil/mathematics.h" | 32 #include "libavutil/mathematics.h" |
| 33 #include "dctref.h" |
| 34 |
33 static double coefficients[8 * 8]; | 35 static double coefficients[8 * 8]; |
34 | 36 |
35 /** | 37 /** |
36 * Initialize the double precision discrete cosine transform | 38 * Initialize the double precision discrete cosine transform |
37 * functions fdct & idct. | 39 * functions fdct & idct. |
38 */ | 40 */ |
39 av_cold void ff_ref_dct_init(void) | 41 av_cold void ff_ref_dct_init(void) |
40 { | 42 { |
41 unsigned int i, j; | 43 unsigned int i, j; |
42 | 44 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 for (i = 0; i < 8; ++i) { | 114 for (i = 0; i < 8; ++i) { |
113 for (j = 0; j < 8; ++j) { | 115 for (j = 0; j < 8; ++j) { |
114 double tmp = 0; | 116 double tmp = 0; |
115 for (k = 0; k < 64; k += 8) { | 117 for (k = 0; k < 64; k += 8) { |
116 tmp += coefficients[k + i] * out[k + j]; | 118 tmp += coefficients[k + i] * out[k + j]; |
117 } | 119 } |
118 block[i * 8 + j] = floor(tmp + 0.5); | 120 block[i * 8 + j] = floor(tmp + 0.5); |
119 } | 121 } |
120 } | 122 } |
121 } | 123 } |
OLD | NEW |