OLD | NEW |
1 // Copyright 2011 Google Inc. All Rights Reserved. | 1 // Copyright 2011 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // This code is licensed under the same terms as WebM: | 3 // This code is licensed under the same terms as WebM: |
4 // Software License Agreement: http://www.webmproject.org/license/software/ | 4 // Software License Agreement: http://www.webmproject.org/license/software/ |
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ | 5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ |
6 // ----------------------------------------------------------------------------- | 6 // ----------------------------------------------------------------------------- |
7 // | 7 // |
8 // Speed-critical functions. | 8 // Speed-critical functions. |
9 // | 9 // |
10 // Author: Skal (pascal.massimino@gmail.com) | 10 // Author: Skal (pascal.massimino@gmail.com) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 kSSE3, | 42 kSSE3, |
43 kNEON | 43 kNEON |
44 } CPUFeature; | 44 } CPUFeature; |
45 // returns true if the CPU supports the feature. | 45 // returns true if the CPU supports the feature. |
46 typedef int (*VP8CPUInfo)(CPUFeature feature); | 46 typedef int (*VP8CPUInfo)(CPUFeature feature); |
47 extern VP8CPUInfo VP8GetCPUInfo; | 47 extern VP8CPUInfo VP8GetCPUInfo; |
48 | 48 |
49 //------------------------------------------------------------------------------ | 49 //------------------------------------------------------------------------------ |
50 // Encoding | 50 // Encoding |
51 | 51 |
52 int VP8GetAlpha(const int histo[]); | |
53 | |
54 // Transforms | 52 // Transforms |
55 // VP8Idct: Does one of two inverse transforms. If do_two is set, the transforms | 53 // VP8Idct: Does one of two inverse transforms. If do_two is set, the transforms |
56 // will be done for (ref, in, dst) and (ref + 4, in + 16, dst + 4). | 54 // will be done for (ref, in, dst) and (ref + 4, in + 16, dst + 4). |
57 typedef void (*VP8Idct)(const uint8_t* ref, const int16_t* in, uint8_t* dst, | 55 typedef void (*VP8Idct)(const uint8_t* ref, const int16_t* in, uint8_t* dst, |
58 int do_two); | 56 int do_two); |
59 typedef void (*VP8Fdct)(const uint8_t* src, const uint8_t* ref, int16_t* out); | 57 typedef void (*VP8Fdct)(const uint8_t* src, const uint8_t* ref, int16_t* out); |
60 typedef void (*VP8WHT)(const int16_t* in, int16_t* out); | 58 typedef void (*VP8WHT)(const int16_t* in, int16_t* out); |
61 extern VP8Idct VP8ITransform; | 59 extern VP8Idct VP8ITransform; |
62 extern VP8Fdct VP8FTransform; | 60 extern VP8Fdct VP8FTransform; |
63 extern VP8WHT VP8ITransformWHT; | 61 extern VP8WHT VP8ITransformWHT; |
(...skipping 14 matching lines...) Expand all Loading... |
78 extern VP8WMetric VP8TDisto4x4, VP8TDisto16x16; | 76 extern VP8WMetric VP8TDisto4x4, VP8TDisto16x16; |
79 | 77 |
80 typedef void (*VP8BlockCopy)(const uint8_t* src, uint8_t* dst); | 78 typedef void (*VP8BlockCopy)(const uint8_t* src, uint8_t* dst); |
81 extern VP8BlockCopy VP8Copy4x4; | 79 extern VP8BlockCopy VP8Copy4x4; |
82 // Quantization | 80 // Quantization |
83 struct VP8Matrix; // forward declaration | 81 struct VP8Matrix; // forward declaration |
84 typedef int (*VP8QuantizeBlock)(int16_t in[16], int16_t out[16], | 82 typedef int (*VP8QuantizeBlock)(int16_t in[16], int16_t out[16], |
85 int n, const struct VP8Matrix* const mtx); | 83 int n, const struct VP8Matrix* const mtx); |
86 extern VP8QuantizeBlock VP8EncQuantizeBlock; | 84 extern VP8QuantizeBlock VP8EncQuantizeBlock; |
87 | 85 |
88 // Compute susceptibility based on DCT-coeff histograms: | 86 // Collect histogram for susceptibility calculation and accumulate in histo[]. |
89 // the higher, the "easier" the macroblock is to compress. | 87 struct VP8Histogram; |
90 typedef int (*VP8CHisto)(const uint8_t* ref, const uint8_t* pred, | 88 typedef void (*VP8CHisto)(const uint8_t* ref, const uint8_t* pred, |
91 int start_block, int end_block); | 89 int start_block, int end_block, |
| 90 struct VP8Histogram* const histo); |
92 extern const int VP8DspScan[16 + 4 + 4]; | 91 extern const int VP8DspScan[16 + 4 + 4]; |
93 extern VP8CHisto VP8CollectHistogram; | 92 extern VP8CHisto VP8CollectHistogram; |
94 | 93 |
95 void VP8EncDspInit(void); // must be called before using any of the above | 94 void VP8EncDspInit(void); // must be called before using any of the above |
96 | 95 |
97 //------------------------------------------------------------------------------ | 96 //------------------------------------------------------------------------------ |
98 // Decoding | 97 // Decoding |
99 | 98 |
100 typedef void (*VP8DecIdct)(const int16_t* coeffs, uint8_t* dst); | 99 typedef void (*VP8DecIdct)(const int16_t* coeffs, uint8_t* dst); |
101 // when doing two transforms, coeffs is actually int16_t[2][16]. | 100 // when doing two transforms, coeffs is actually int16_t[2][16]. |
102 typedef void (*VP8DecIdct2)(const int16_t* coeffs, uint8_t* dst, int do_two); | 101 typedef void (*VP8DecIdct2)(const int16_t* coeffs, uint8_t* dst, int do_two); |
103 extern VP8DecIdct2 VP8Transform; | 102 extern VP8DecIdct2 VP8Transform; |
104 extern VP8DecIdct VP8TransformUV; | 103 extern VP8DecIdct VP8TransformUV; |
105 extern VP8DecIdct VP8TransformDC; | 104 extern VP8DecIdct VP8TransformDC; |
106 extern VP8DecIdct VP8TransformDCUV; | 105 extern VP8DecIdct VP8TransformDCUV; |
107 extern void (*VP8TransformWHT)(const int16_t* in, int16_t* out); | 106 extern VP8WHT VP8TransformWHT; |
108 | 107 |
109 // *dst is the destination block, with stride BPS. Boundary samples are | 108 // *dst is the destination block, with stride BPS. Boundary samples are |
110 // assumed accessible when needed. | 109 // assumed accessible when needed. |
111 typedef void (*VP8PredFunc)(uint8_t* dst); | 110 typedef void (*VP8PredFunc)(uint8_t* dst); |
112 extern const VP8PredFunc VP8PredLuma16[/* NUM_B_DC_MODES */]; | 111 extern const VP8PredFunc VP8PredLuma16[/* NUM_B_DC_MODES */]; |
113 extern const VP8PredFunc VP8PredChroma8[/* NUM_B_DC_MODES */]; | 112 extern const VP8PredFunc VP8PredChroma8[/* NUM_B_DC_MODES */]; |
114 extern const VP8PredFunc VP8PredLuma4[/* NUM_BMODES */]; | 113 extern const VP8PredFunc VP8PredLuma4[/* NUM_BMODES */]; |
115 | 114 |
116 // simple filter (only for luma) | 115 // simple filter (only for luma) |
117 typedef void (*VP8SimpleFilterFunc)(uint8_t* p, int stride, int thresh); | 116 typedef void (*VP8SimpleFilterFunc)(uint8_t* p, int stride, int thresh); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 uint8_t* top_dst, uint8_t* bottom_dst, int len); | 151 uint8_t* top_dst, uint8_t* bottom_dst, int len); |
153 | 152 |
154 #ifdef FANCY_UPSAMPLING | 153 #ifdef FANCY_UPSAMPLING |
155 | 154 |
156 // Fancy upsampling functions to convert YUV to RGB(A) modes | 155 // Fancy upsampling functions to convert YUV to RGB(A) modes |
157 extern WebPUpsampleLinePairFunc WebPUpsamplers[/* MODE_LAST */]; | 156 extern WebPUpsampleLinePairFunc WebPUpsamplers[/* MODE_LAST */]; |
158 | 157 |
159 // Initializes SSE2 version of the fancy upsamplers. | 158 // Initializes SSE2 version of the fancy upsamplers. |
160 void WebPInitUpsamplersSSE2(void); | 159 void WebPInitUpsamplersSSE2(void); |
161 | 160 |
| 161 // NEON version |
| 162 void WebPInitUpsamplersNEON(void); |
| 163 |
162 #endif // FANCY_UPSAMPLING | 164 #endif // FANCY_UPSAMPLING |
163 | 165 |
164 // Point-sampling methods. | 166 // Point-sampling methods. |
165 typedef void (*WebPSampleLinePairFunc)( | 167 typedef void (*WebPSampleLinePairFunc)( |
166 const uint8_t* top_y, const uint8_t* bottom_y, | 168 const uint8_t* top_y, const uint8_t* bottom_y, |
167 const uint8_t* u, const uint8_t* v, | 169 const uint8_t* u, const uint8_t* v, |
168 uint8_t* top_dst, uint8_t* bottom_dst, int len); | 170 uint8_t* top_dst, uint8_t* bottom_dst, int len); |
169 | 171 |
170 extern const WebPSampleLinePairFunc WebPSamplers[/* MODE_LAST */]; | 172 extern const WebPSampleLinePairFunc WebPSamplers[/* MODE_LAST */]; |
171 | 173 |
(...skipping 21 matching lines...) Expand all Loading... |
193 uint8_t* rgba, int alpha_first, int w, int h, int stride); | 195 uint8_t* rgba, int alpha_first, int w, int h, int stride); |
194 | 196 |
195 // Same, buf specifically for RGBA4444 format | 197 // Same, buf specifically for RGBA4444 format |
196 extern void (*WebPApplyAlphaMultiply4444)( | 198 extern void (*WebPApplyAlphaMultiply4444)( |
197 uint8_t* rgba4444, int w, int h, int stride); | 199 uint8_t* rgba4444, int w, int h, int stride); |
198 | 200 |
199 // To be called first before using the above. | 201 // To be called first before using the above. |
200 void WebPInitPremultiply(void); | 202 void WebPInitPremultiply(void); |
201 | 203 |
202 void WebPInitPremultiplySSE2(void); // should not be called directly. | 204 void WebPInitPremultiplySSE2(void); // should not be called directly. |
| 205 void WebPInitPremultiplyNEON(void); |
203 | 206 |
204 //------------------------------------------------------------------------------ | 207 //------------------------------------------------------------------------------ |
205 | 208 |
206 #if defined(__cplusplus) || defined(c_plusplus) | 209 #if defined(__cplusplus) || defined(c_plusplus) |
207 } // extern "C" | 210 } // extern "C" |
208 #endif | 211 #endif |
209 | 212 |
210 #endif /* WEBP_DSP_DSP_H_ */ | 213 #endif /* WEBP_DSP_DSP_H_ */ |
OLD | NEW |