openjpeg-20070821svn-t1-flags-stride.patch 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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-23 05:48:09.000000000 -0500
  3. +++ OpenJPEG.patched/libopenjpeg/t1.c 2007-08-23 05:50:29.000000000 -0500
  4. @@ -312,7 +312,7 @@
  5. } else {
  6. mqc_encode(mqc, v ^ t1_getspb(flag));
  7. }
  8. - t1_updateflags(flagsp, v, t1->flags_stride);
  9. + t1_updateflags(flagsp, v, (t1->h+2));
  10. }
  11. *flagsp |= T1_VISIT;
  12. }
  13. @@ -339,7 +339,7 @@
  14. if (raw_decode(raw)) {
  15. v = raw_decode(raw); /* ESSAI */
  16. *datap = v ? -oneplushalf : oneplushalf;
  17. - t1_updateflags(flagsp, v, t1->flags_stride);
  18. + t1_updateflags(flagsp, v, (t1->h+2));
  19. }
  20. } else {
  21. mqc_setcurctx(mqc, t1_getctxno_zc(flag, orient));
  22. @@ -347,7 +347,7 @@
  23. mqc_setcurctx(mqc, t1_getctxno_sc(flag));
  24. v = mqc_decode(mqc) ^ t1_getspb(flag);
  25. *datap = v ? -oneplushalf : oneplushalf;
  26. - t1_updateflags(flagsp, v, t1->flags_stride);
  27. + t1_updateflags(flagsp, v, (t1->h+2));
  28. }
  29. }
  30. }
  31. @@ -370,7 +370,7 @@
  32. vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
  33. t1_enc_sigpass_step(
  34. t1,
  35. - &t1->flags[(j+1) + (i+1)*t1->flags_stride],
  36. + &t1->flags[(j+1) + (i+1)*(t1->h+2)],
  37. &t1->data[(j * t1->w) + i],
  38. orient,
  39. bpno,
  40. @@ -400,7 +400,7 @@
  41. vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
  42. t1_dec_sigpass_step(
  43. t1,
  44. - &t1->flags[(j+1) + (i+1)*t1->flags_stride],
  45. + &t1->flags[(j+1) + (i+1)*(t1->h+2)],
  46. &t1->data[(j * t1->w) + i],
  47. orient,
  48. oneplushalf,
  49. @@ -483,7 +483,7 @@
  50. vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
  51. t1_enc_refpass_step(
  52. t1,
  53. - &t1->flags[(j+1) + (i+1)*t1->flags_stride],
  54. + &t1->flags[(j+1) + (i+1)*(t1->h+2)],
  55. &t1->data[(j * t1->w) + i],
  56. bpno,
  57. one,
  58. @@ -512,7 +512,7 @@
  59. vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
  60. t1_dec_refpass_step(
  61. t1,
  62. - &t1->flags[(j+1) + (i+1)*t1->flags_stride],
  63. + &t1->flags[(j+1) + (i+1)*(t1->h+2)],
  64. &t1->data[(j * t1->w) + i],
  65. poshalf,
  66. neghalf,
  67. @@ -552,7 +552,7 @@
  68. mqc_setcurctx(mqc, t1_getctxno_sc(flag));
  69. v = *datap < 0 ? 1 : 0;
  70. mqc_encode(mqc, v ^ t1_getspb(flag));
  71. - t1_updateflags(flagsp, v, t1->flags_stride);
  72. + t1_updateflags(flagsp, v, (t1->h+2));
  73. }
  74. }
  75. *flagsp &= ~T1_VISIT;
  76. @@ -582,7 +582,7 @@
  77. mqc_setcurctx(mqc, t1_getctxno_sc(flag));
  78. v = mqc_decode(mqc) ^ t1_getspb(flag);
  79. *datap = v ? -oneplushalf : oneplushalf;
  80. - t1_updateflags(flagsp, v, t1->flags_stride);
  81. + t1_updateflags(flagsp, v, (t1->h+2));
  82. }
  83. }
  84. *flagsp &= ~T1_VISIT;
  85. @@ -605,16 +605,16 @@
  86. for (i = 0; i < t1->w; ++i) {
  87. if (k + 3 < t1->h) {
  88. if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  89. - agg = !(t1->flags[(k+1) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  90. - || t1->flags[(k+2) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  91. - || t1->flags[(k+3) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  92. - || (t1->flags[(k+4) + (i+1)*t1->flags_stride]
  93. + agg = !(t1->flags[(k+1) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  94. + || t1->flags[(k+2) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  95. + || t1->flags[(k+3) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  96. + || (t1->flags[(k+4) + (i+1)*(t1->h+2)]
  97. & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
  98. } else {
  99. - agg = !(t1->flags[(k+1) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  100. - || t1->flags[(k+2) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  101. - || t1->flags[(k+3) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  102. - || t1->flags[(k+4) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH));
  103. + agg = !(t1->flags[(k+1) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  104. + || t1->flags[(k+2) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  105. + || t1->flags[(k+3) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  106. + || t1->flags[(k+4) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH));
  107. }
  108. } else {
  109. agg = 0;
  110. @@ -639,7 +639,7 @@
  111. vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
  112. t1_enc_clnpass_step(
  113. t1,
  114. - &t1->flags[(j+1) + (i+1)*t1->flags_stride],
  115. + &t1->flags[(j+1) + (i+1)*(t1->h+2)],
  116. &t1->data[(j * t1->w) + i],
  117. orient,
  118. bpno,
  119. @@ -670,7 +670,7 @@
  120. for (i = 0; i < t1->w; ++i) {
  121. if (k + 3 < t1->h) {
  122. #ifdef __amd64__
  123. - int64 tmp = *((int64*)&t1->flags[(k+1) + (i+1)*t1->flags_stride]);
  124. + int64 tmp = *((int64*)&t1->flags[(k+1) + (i+1)*(t1->h+2)]);
  125. if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  126. tmp &= ~((int64)(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S)<<48);
  127. }
  128. @@ -681,16 +681,16 @@
  129. agg = !tmp;
  130. #else
  131. if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  132. - agg = !(t1->flags[(k+1) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  133. - || t1->flags[(k+2) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  134. - || t1->flags[(k+3) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  135. - || (t1->flags[(k+4) + (i+1)*t1->flags_stride]
  136. + agg = !(t1->flags[(k+1) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  137. + || t1->flags[(k+2) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  138. + || t1->flags[(k+3) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  139. + || (t1->flags[(k+4) + (i+1)*(t1->h+2)]
  140. & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
  141. } else {
  142. - agg = !(t1->flags[(k+1) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  143. - || t1->flags[(k+2) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  144. - || t1->flags[(k+3) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  145. - || t1->flags[(k+4) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH));
  146. + agg = !(t1->flags[(k+1) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  147. + || t1->flags[(k+2) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  148. + || t1->flags[(k+3) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
  149. + || t1->flags[(k+4) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH));
  150. }
  151. #endif
  152. } else {
  153. @@ -711,7 +711,7 @@
  154. vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
  155. t1_dec_clnpass_step(
  156. t1,
  157. - &t1->flags[(j+1) + (i+1)*t1->flags_stride],
  158. + &t1->flags[(j+1) + (i+1)*(t1->h+2)],
  159. &t1->data[(j * t1->w) + i],
  160. orient,
  161. oneplushalf,
  162. @@ -779,8 +779,7 @@
  163. }
  164. memset(t1->data,0,datasize * sizeof(int));
  165. - t1->flags_stride=h+2;
  166. - flagssize=t1->flags_stride * (w+2);
  167. + flagssize=(h+2) * (w+2);
  168. if(flagssize > t1->flagssize){
  169. opj_aligned_free(t1->flags);
  170. diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/t1.h OpenJPEG.patched/libopenjpeg/t1.h
  171. --- OpenJPEG.orig/libopenjpeg/t1.h 2007-08-23 05:48:09.000000000 -0500
  172. +++ OpenJPEG.patched/libopenjpeg/t1.h 2007-08-23 05:48:37.000000000 -0500
  173. @@ -105,7 +105,6 @@
  174. int h;
  175. int datasize;
  176. int flagssize;
  177. - int flags_stride;
  178. } opj_t1_t;
  179. /** @name Exported functions */