openjpeg-20070719svn-t1-x86_64-flags-branchless.patch 1.3 KB

123456789101112131415161718192021222324252627282930
  1. diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/t1.c OpenJPEG.patched/libopenjpeg/t1.c
  2. --- OpenJPEG.orig/libopenjpeg/t1.c 2007-08-06 14:07:59.000000000 -0500
  3. +++ OpenJPEG.patched/libopenjpeg/t1.c 2007-08-06 15:54:31.000000000 -0500
  4. @@ -669,6 +669,17 @@
  5. for (k = 0; k < t1->h; k += 4) {
  6. for (i = 0; i < t1->w; ++i) {
  7. if (k + 3 < t1->h) {
  8. +#ifdef __amd64__
  9. + int64 tmp = *((int64*)&t1->flags[(k+1) + (i+1)*t1->flags_stride]);
  10. + if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  11. + tmp &= ~((int64)(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S)<<48);
  12. + }
  13. + tmp &= (int64)(T1_SIG | T1_VISIT | T1_SIG_OTH)
  14. + | ((int64)(T1_SIG | T1_VISIT | T1_SIG_OTH)<<16)
  15. + | ((int64)(T1_SIG | T1_VISIT | T1_SIG_OTH)<<32)
  16. + | ((int64)(T1_SIG | T1_VISIT | T1_SIG_OTH)<<48);
  17. + agg = !tmp;
  18. +#else
  19. if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  20. agg = !(t1->flags[(k+1) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  21. || t1->flags[(k+2) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  22. @@ -681,6 +692,7 @@
  23. || t1->flags[(k+3) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  24. || t1->flags[(k+4) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH));
  25. }
  26. +#endif
  27. } else {
  28. agg = 0;
  29. }