summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2014-07-23 13:05:23 -0700
committerBo Xu <bo_xu@foxitsoftware.com>2014-07-23 13:05:23 -0700
commitf7f6b0cef0853008f857dc4a2622e7888a37c627 (patch)
treed399a34c695754ef13d7494b0e0fb3aad0aa36bd
parent10e6c7cce60cf54a7c2e883fa02101bb2921f195 (diff)
downloadpdfium-f7f6b0cef0853008f857dc4a2622e7888a37c627.tar.xz
Remove unnecessary aligned memory check when __SSE__ is used
Since the land of https://pdfium.googlesource.com/pdfium/+/3522876d5291922ddc62bf1b70d02743b0850673, memory is assured to be 16 byte aligned. So no need to do this check. Plus, the removed code was causing bug in M36: https://code.google.com/p/pdfium/issues/detail?id=27. BUG=None R=thestig@chromium.org Review URL: https://codereview.chromium.org/418563002
-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];