openjpeg-20070717svn-mqc-optimize.patch 847 B

1234567891011121314151617181920212223242526272829303132
  1. diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/mqc.c OpenJPEG.patched/libopenjpeg/mqc.c
  2. --- OpenJPEG.orig/libopenjpeg/mqc.c 2007-07-17 20:07:22.000000000 -0500
  3. +++ OpenJPEG.patched/libopenjpeg/mqc.c 2007-07-17 20:07:44.000000000 -0500
  4. @@ -507,20 +507,20 @@
  5. int mqc_decode(opj_mqc_t *mqc) {
  6. int d;
  7. - mqc->a -= (*mqc->curctx)->qeval;
  8. - if ((mqc->c >> 16) < (*mqc->curctx)->qeval) {
  9. + unsigned int qeval = (*mqc->curctx)->qeval;
  10. + mqc->a -= qeval;
  11. + qeval <<= 16;
  12. + if (mqc->c < qeval) {
  13. d = mqc_lpsexchange(mqc);
  14. - mqc_renormd(mqc);
  15. } else {
  16. - mqc->c -= (*mqc->curctx)->qeval << 16;
  17. + mqc->c -= qeval;
  18. if ((mqc->a & 0x8000) == 0) {
  19. d = mqc_mpsexchange(mqc);
  20. - mqc_renormd(mqc);
  21. } else {
  22. - d = (*mqc->curctx)->mps;
  23. + return (*mqc->curctx)->mps;
  24. }
  25. }
  26. -
  27. + mqc_renormd(mqc);
  28. return d;
  29. }