summaryrefslogtreecommitdiff
path: root/core/src/fxcodec
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxcodec')
-rw-r--r--core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/mct.c89
1 files changed, 37 insertions, 52 deletions
diff --git a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/mct.c b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/mct.c
index c4341ec1bb..89f82225a0 100644
--- a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/mct.c
+++ b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/mct.c
@@ -150,58 +150,43 @@ void opj_mct_decode_real(
{
OPJ_UINT32 i;
#ifdef __SSE__
- // Mantis BUGID: 0056291. The address must be 16-byte aligned.
- // TestFile: fuzz-signal_sigsegv_6e9e7f_5076_5265.pdf
- if ((OPJ_UINT32)c0 % 16 == 0 && (OPJ_UINT32)c1 % 16 == 0 && (OPJ_UINT32)c2 % 16 == 0){
- __m128 vrv, vgu, vgv, vbu;
- vrv = _mm_set1_ps(1.402f);
- vgu = _mm_set1_ps(0.34413f);
- vgv = _mm_set1_ps(0.71414f);
- vbu = _mm_set1_ps(1.772f);
- for (i = 0; i < (n >> 3); ++i) {
- __m128 vy, vu, vv;
- __m128 vr, vg, vb;
-
- vy = _mm_load_ps(c0);
- vu = _mm_load_ps(c1);
- vv = _mm_load_ps(c2);
- vr = _mm_add_ps(vy, _mm_mul_ps(vv, vrv));
- vg = _mm_sub_ps(_mm_sub_ps(vy, _mm_mul_ps(vu, vgu)), _mm_mul_ps(vv, vgv));
- vb = _mm_add_ps(vy, _mm_mul_ps(vu, vbu));
- _mm_store_ps(c0, vr);
- _mm_store_ps(c1, vg);
- _mm_store_ps(c2, vb);
- c0 += 4;
- c1 += 4;
- c2 += 4;
-
- vy = _mm_load_ps(c0);
- vu = _mm_load_ps(c1);
- vv = _mm_load_ps(c2);
- vr = _mm_add_ps(vy, _mm_mul_ps(vv, vrv));
- vg = _mm_sub_ps(_mm_sub_ps(vy, _mm_mul_ps(vu, vgu)), _mm_mul_ps(vv, vgv));
- vb = _mm_add_ps(vy, _mm_mul_ps(vu, vbu));
- _mm_store_ps(c0, vr);
- _mm_store_ps(c1, vg);
- _mm_store_ps(c2, vb);
- c0 += 4;
- c1 += 4;
- c2 += 4;
- }
- n &= 7;
- } else {
- for (i = 0; i < n; ++i) {
- OPJ_FLOAT32 y = c0[i];
- OPJ_FLOAT32 u = c1[i];
- OPJ_FLOAT32 v = c2[i];
- OPJ_FLOAT32 r = y + (v * 1.402f);
- OPJ_FLOAT32 g = y - (u * 0.34413f) - (v * (0.71414f));
- OPJ_FLOAT32 b = y + (u * 1.772f);
- c0[i] = r;
- c1[i] = g;
- c2[i] = b;
- }
- }
+ __m128 vrv, vgu, vgv, vbu;
+ vrv = _mm_set1_ps(1.402f);
+ vgu = _mm_set1_ps(0.34413f);
+ vgv = _mm_set1_ps(0.71414f);
+ vbu = _mm_set1_ps(1.772f);
+ for (i = 0; i < (n >> 3); ++i) {
+ __m128 vy, vu, vv;
+ __m128 vr, vg, vb;
+
+ vy = _mm_load_ps(c0);
+ vu = _mm_load_ps(c1);
+ vv = _mm_load_ps(c2);
+ vr = _mm_add_ps(vy, _mm_mul_ps(vv, vrv));
+ vg = _mm_sub_ps(_mm_sub_ps(vy, _mm_mul_ps(vu, vgu)), _mm_mul_ps(vv, vgv));
+ vb = _mm_add_ps(vy, _mm_mul_ps(vu, vbu));
+ _mm_store_ps(c0, vr);
+ _mm_store_ps(c1, vg);
+ _mm_store_ps(c2, vb);
+ c0 += 4;
+ c1 += 4;
+ c2 += 4;
+
+ vy = _mm_load_ps(c0);
+ vu = _mm_load_ps(c1);
+ vv = _mm_load_ps(c2);
+ vr = _mm_add_ps(vy, _mm_mul_ps(vv, vrv));
+ vg = _mm_sub_ps(_mm_sub_ps(vy, _mm_mul_ps(vu, vgu)), _mm_mul_ps(vv, vgv));
+ vb = _mm_add_ps(vy, _mm_mul_ps(vu, vbu));
+ _mm_store_ps(c0, vr);
+ _mm_store_ps(c1, vg);
+ _mm_store_ps(c2, vb);
+ c0 += 4;
+ c1 += 4;
+ c2 += 4;
+ }
+ n &= 7;
+
#endif
for(i = 0; i < n; ++i) {
OPJ_FLOAT32 y = c0[i];