transcode-1.1.7-imagemagick7.patch 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795
  1. http://git.pld-linux.org/?p=packages/transcode.git;a=blob_plain;f=imagemagick7.patch;h=8411f89b843764eff8f4aaddb314d7773d1bcec8;hb=HEAD
  2. --- transcode-1.1.7/configure.in
  3. +++ transcode-1.1.7/configure.in
  4. @@ -1105,8 +1105,8 @@
  5. dnl ImageMagick
  6. dnl
  7. IMAGEMAGICK_EXTRA_LIBS="$IMAGEMAGICK_EXTRA_LIBS $($PKG_CONFIG --libs ImageMagick)"
  8. -TC_PKG_CHECK(imagemagick, no, IMAGEMAGICK, no, [magick/api.h],
  9. - none, InitializeMagick, Wand, [http://www.imagemagick.org/])
  10. +TC_PKG_CHECK(imagemagick, no, IMAGEMAGICK, no, [MagickWand/MagickWand.h],
  11. + none, InitializeMagick, MagickWand, [http://www.imagemagick.org/])
  12. TC_PKG_HAVE(imagemagick, IMAGEMAGICK)
  13. if test x"$have_imagemagick" = x"yes" ; then
  14. SAVE_CPPFLAGS="$CPPFLAGS"
  15. @@ -1114,6 +1114,7 @@
  16. AC_CHECK_HEADER([wand/magick-wand.h],
  17. [AC_DEFINE([HAVE_BROKEN_WAND], [1], ["have old wand header"])])
  18. CPPFLAGS="$SAVE_CPPFLAGS"
  19. + IMAGEMAGICK_CFLAGS="$IMAGEMAGICK_CFLAGS $($PKG_CONFIG --cflags ImageMagick)"
  20. fi
  21. dnl
  22. --- transcode-1.1.7/export/export_im.c
  23. +++ transcode-1.1.7/export/export_im.c
  24. @@ -23,7 +23,7 @@
  25. /* Note: because of ImageMagick bogosity, this must be included first, so
  26. * we can undefine the PACKAGE_* symbols it splats into our namespace */
  27. -#include <magick/api.h>
  28. +#include <MagickCore/MagickCore.h>
  29. #undef PACKAGE_BUGREPORT
  30. #undef PACKAGE_NAME
  31. #undef PACKAGE_STRING
  32. @@ -82,7 +82,7 @@
  33. codec = (vob->im_v_codec == CODEC_YUV) ? CODEC_YUV : CODEC_RGB;
  34. - InitializeMagick("");
  35. + MagickCoreGenesis("", MagickFalse);
  36. image_info=CloneImageInfo((ImageInfo *) NULL);
  37. @@ -169,8 +169,8 @@
  38. MOD_encode
  39. {
  40. - ExceptionInfo exception_info;
  41. - char *out_buffer = param->buffer;
  42. + ExceptionInfo *exception_info;
  43. + unsigned char *out_buffer = param->buffer;
  44. Image *image=NULL;
  45. int res;
  46. @@ -179,7 +179,7 @@
  47. if(param->flag == TC_VIDEO) {
  48. - GetExceptionInfo(&exception_info);
  49. + exception_info = AcquireExceptionInfo();
  50. res = tc_snprintf(buf2, PATH_MAX, "%s%06d.%s", prefix, counter++, type);
  51. if (res < 0) {
  52. @@ -193,11 +193,11 @@
  53. out_buffer = tmp_buffer;
  54. }
  55. - image=ConstituteImage (width, height, "RGB", CharPixel, out_buffer, &exception_info);
  56. + image=ConstituteImage (width, height, "RGB", CharPixel, out_buffer, exception_info);
  57. strlcpy(image->filename, buf2, MaxTextExtent);
  58. - WriteImage(image_info, image);
  59. + WriteImage(image_info, image, exception_info);
  60. DestroyImage(image);
  61. return(0);
  62. @@ -220,8 +220,7 @@
  63. if(param->flag == TC_VIDEO) {
  64. DestroyImageInfo(image_info);
  65. - ConstituteComponentTerminus();
  66. - DestroyMagick();
  67. + MagickCoreTerminus();
  68. free(tmp_buffer);
  69. tmp_buffer = NULL;
  70. --- transcode-1.1.7/filter/filter_compare.c
  71. +++ transcode-1.1.7/filter/filter_compare.c
  72. @@ -24,7 +24,7 @@
  73. /* Note: because of ImageMagick bogosity, this must be included first, so
  74. * we can undefine the PACKAGE_* symbols it splats into our namespace */
  75. -#include <magick/api.h>
  76. +#include <MagickCore/MagickCore.h>
  77. #undef PACKAGE_BUGREPORT
  78. #undef PACKAGE_NAME
  79. #undef PACKAGE_STRING
  80. @@ -111,9 +111,9 @@
  81. Image *pattern, *resized, *orig = 0;
  82. ImageInfo *image_info;
  83. - PixelPacket *pixel_packet;
  84. + Quantum *pixel_quantum;
  85. pixelsMask *pixel_last;
  86. - ExceptionInfo exception_info;
  87. + ExceptionInfo *exception_info;
  88. if(ptr->tag & TC_FILTER_GET_CONFIG) {
  89. char buf[128];
  90. @@ -139,7 +139,7 @@
  91. if(ptr->tag & TC_FILTER_INIT)
  92. {
  93. - unsigned int t,r,index;
  94. + unsigned int t,r;
  95. pixelsMask *temp;
  96. compare[instance] = tc_malloc(sizeof(compareData));
  97. @@ -190,22 +190,22 @@
  98. tc_log_perror(MOD_NAME, "could not open file for writing");
  99. }
  100. - InitializeMagick("");
  101. + MagickCoreGenesis("", MagickFalse);
  102. if (verbose > 1)
  103. tc_log_info(MOD_NAME, "Magick Initialized successfully");
  104. - GetExceptionInfo(&exception_info);
  105. + exception_info = AcquireExceptionInfo();
  106. image_info = CloneImageInfo ((ImageInfo *) NULL);
  107. strlcpy(image_info->filename, pattern_name, MaxTextExtent);
  108. if (verbose > 1)
  109. tc_log_info(MOD_NAME, "Trying to open image");
  110. orig = ReadImage(image_info,
  111. - &exception_info);
  112. + exception_info);
  113. if (orig == (Image *) NULL) {
  114. - MagickWarning(exception_info.severity,
  115. - exception_info.reason,
  116. - exception_info.description);
  117. + MagickWarning(exception_info->severity,
  118. + exception_info->reason,
  119. + exception_info->description);
  120. strlcpy(pattern_name, "/dev/null", sizeof(pattern_name));
  121. }else{
  122. if (verbose > 1)
  123. @@ -228,42 +228,41 @@
  124. if (orig != NULL){
  125. // Flip and resize
  126. if (compare[instance]->vob->im_v_codec == CODEC_YUV)
  127. - TransformRGBImage(orig,YCbCrColorspace);
  128. + TransformImageColorspace(orig, YCbCrColorspace, exception_info);
  129. if (verbose > 1) tc_log_info(MOD_NAME, "Resizing the Image");
  130. resized = ResizeImage(orig,
  131. compare[instance]->width,
  132. compare[instance]->height,
  133. GaussianFilter,
  134. - 1,
  135. - &exception_info);
  136. + exception_info);
  137. if (verbose > 1)
  138. tc_log_info(MOD_NAME, "Flipping the Image");
  139. - pattern = FlipImage(resized, &exception_info);
  140. + pattern = FlipImage(resized, exception_info);
  141. if (pattern == (Image *) NULL) {
  142. - MagickError (exception_info.severity,
  143. - exception_info.reason,
  144. - exception_info.description);
  145. + MagickError (exception_info->severity,
  146. + exception_info->reason,
  147. + exception_info->description);
  148. }
  149. // Filling the matrix with the pixels values not
  150. // alpha
  151. if (verbose > 1) tc_log_info(MOD_NAME, "GetImagePixels");
  152. - pixel_packet = GetImagePixels(pattern,0,0,
  153. + pixel_quantum = GetAuthenticPixels(pattern,0,0,
  154. pattern->columns,
  155. - pattern->rows);
  156. + pattern->rows,
  157. + exception_info);
  158. if (verbose > 1) tc_log_info(MOD_NAME, "Filling the Image matrix");
  159. for (t = 0; t < pattern->rows; t++)
  160. for (r = 0; r < pattern->columns; r++){
  161. - index = t*pattern->columns + r;
  162. - if (pixel_packet[index].opacity == 0){
  163. + if (GetPixelAlpha(pattern, pixel_quantum) == QuantumRange) {
  164. temp=tc_malloc(sizeof(struct pixelsMask));
  165. temp->row=t;
  166. temp->col=r;
  167. - temp->r = (uint8_t)ScaleQuantumToChar(pixel_packet[index].red);
  168. - temp->g = (uint8_t)ScaleQuantumToChar(pixel_packet[index].green);
  169. - temp->b = (uint8_t)ScaleQuantumToChar(pixel_packet[index].blue);
  170. + temp->r = (uint8_t)ScaleQuantumToChar(GetPixelRed(pattern, pixel_quantum));
  171. + temp->g = (uint8_t)ScaleQuantumToChar(GetPixelGreen(pattern, pixel_quantum));
  172. + temp->b = (uint8_t)ScaleQuantumToChar(GetPixelBlue(pattern, pixel_quantum));
  173. temp->next=NULL;
  174. if (pixel_last == NULL){
  175. @@ -274,6 +273,7 @@
  176. pixel_last = temp;
  177. }
  178. }
  179. + pixel_quantum += GetPixelChannels(pattern);
  180. }
  181. if (verbose)
  182. @@ -297,7 +297,7 @@
  183. fclose(compare[instance]->results);
  184. free(compare[instance]);
  185. }
  186. - DestroyMagick();
  187. + MagickCoreTerminus();
  188. compare[instance]=NULL;
  189. return(0);
  190. --- transcode-1.1.7/filter/filter_logoaway.c
  191. +++ transcode-1.1.7/filter/filter_logoaway.c
  192. @@ -70,7 +70,7 @@
  193. /* Note: because of ImageMagick bogosity, this must be included first, so
  194. * we can undefine the PACKAGE_* symbols it splats into our namespace */
  195. -#include <magick/api.h>
  196. +#include <MagickCore/MagickCore.h>
  197. #undef PACKAGE_BUGREPORT
  198. #undef PACKAGE_NAME
  199. #undef PACKAGE_STRING
  200. @@ -103,10 +103,10 @@
  201. int alpha;
  202. - ExceptionInfo exception_info;
  203. + ExceptionInfo *exception_info;
  204. Image *image;
  205. ImageInfo *image_info;
  206. - PixelPacket *pixel_packet;
  207. + Quantum *pixel_packet;
  208. int dump;
  209. char *dump_buf;
  210. @@ -174,7 +174,7 @@
  211. * instance filter instance
  212. * @return void nothing
  213. *********************************************************/
  214. -static void work_with_rgb_frame(logoaway_data *LD, char *buffer, int width, int height)
  215. +static void work_with_rgb_frame(logoaway_data *LD, unsigned char *buffer, int width, int height)
  216. {
  217. int row, col, i;
  218. int xdistance, ydistance, distance_west, distance_north;
  219. @@ -201,10 +201,10 @@
  220. }
  221. }
  222. - LD->dumpimage = ConstituteImage(LD->width-LD->xpos, LD->height-LD->ypos, "RGB", CharPixel, LD->dump_buf, &LD->exception_info);
  223. + LD->dumpimage = ConstituteImage(LD->width-LD->xpos, LD->height-LD->ypos, "RGB", CharPixel, LD->dump_buf, LD->exception_info);
  224. tc_snprintf(LD->dumpimage->filename, MaxTextExtent, "dump[%d].png", LD->id);
  225. - WriteImage(LD->dumpimage_info, LD->dumpimage);
  226. + WriteImage(LD->dumpimage_info, LD->dumpimage, LD->exception_info);
  227. }
  228. switch(LD->mode) {
  229. @@ -218,27 +218,28 @@
  230. for(row=LD->ypos; row<LD->height; ++row) {
  231. for(col=LD->xpos; col<LD->width; ++col) {
  232. + Quantum *pixel = LD->pixel_packet + (row*LD->width+col)*GetPixelChannels(LD->image);
  233. buf_off = ((height-row)*width+col) * 3;
  234. pkt_off = (row-LD->ypos) * (LD->width-LD->xpos) + (col-LD->xpos);
  235. /* R */
  236. if (!LD->alpha) {
  237. buffer[buf_off +0] = LD->rcolor;
  238. } else {
  239. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red);
  240. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, pixel));
  241. buffer[buf_off +0] = alpha_blending(buffer[buf_off +0], LD->rcolor, alpha_px);
  242. }
  243. /* G */
  244. if (!LD->alpha) {
  245. buffer[buf_off +1] = LD->gcolor;
  246. } else {
  247. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].green);
  248. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelGreen(LD->image, pixel));
  249. buffer[buf_off +1] = alpha_blending(buffer[buf_off +1], LD->gcolor, alpha_px);
  250. }
  251. /* B */
  252. if (!LD->alpha) {
  253. buffer[buf_off +2] = LD->bcolor;
  254. } else {
  255. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].blue);
  256. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelBlue(LD->image, pixel));
  257. buffer[buf_off +2] = alpha_blending(buffer[buf_off +2], LD->bcolor, alpha_px);
  258. }
  259. }
  260. @@ -268,6 +269,7 @@
  261. buf_off = ((height-row)*width+col) * 3;
  262. pkt_off = (row-LD->ypos) * (LD->width-LD->xpos) + (col-LD->xpos);
  263. + Quantum *pixel = LD->pixel_packet + pkt_off*GetPixelChannels(LD->image);
  264. /* R */
  265. hcalc = alpha_blending(buffer[buf_off_xpos +0], buffer[buf_off_width +0], alpha_hori);
  266. @@ -276,7 +278,7 @@
  267. if (!LD->alpha) {
  268. buffer[buf_off +0] = new_px;
  269. } else {
  270. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red);
  271. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, pixel));
  272. buffer[buf_off +0] = alpha_blending(buffer[buf_off +0], new_px, alpha_px);
  273. }
  274. /* G */
  275. @@ -286,7 +288,7 @@
  276. if (!LD->alpha) {
  277. buffer[buf_off +1] = new_px;
  278. } else {
  279. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].green);
  280. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelGreen(LD->image, pixel));
  281. buffer[buf_off +1] = alpha_blending(buffer[buf_off +1], new_px, alpha_px);
  282. }
  283. /* B */
  284. @@ -296,7 +298,7 @@
  285. if (!LD->alpha) {
  286. buffer[buf_off +2] = new_px;
  287. } else {
  288. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red);
  289. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelBlue(LD->image, pixel));
  290. buffer[buf_off +2] = alpha_blending(buffer[buf_off +2], new_px, alpha_px);
  291. }
  292. }
  293. @@ -327,28 +329,28 @@
  294. buf_off_height = ((height-LD->height)*width+col) * 3;
  295. i = 0;
  296. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off-i].red);
  297. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off-i)*GetPixelChannels(LD->image)));
  298. while ((alpha_px != 255) && (col-i>LD->xpos))
  299. i++;
  300. buf_off_xpos = ((height-row)*width + col-i) * 3;
  301. i = 0;
  302. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off+i].red);
  303. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off+i)*GetPixelChannels(LD->image)));
  304. while ((alpha_px != 255) && (col+i<LD->width))
  305. i++;
  306. buf_off_width = ((height-row)*width + col+i) * 3;
  307. i = 0;
  308. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off-i*(LD->width-LD->xpos)].red);
  309. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off-i*(LD->width-LD->xpos))*GetPixelChannels(LD->image)));
  310. while ((alpha_px != 255) && (row-i>LD->ypos))
  311. i++;
  312. buf_off_ypos = (height*width*3)-((row-i)*width - col) * 3;
  313. i = 0;
  314. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off+i*(LD->width-LD->xpos)].red);
  315. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off+i*(LD->width-LD->xpos))*GetPixelChannels(LD->image)));
  316. while ((alpha_px != 255) && (row+i<LD->height))
  317. i++;
  318. buf_off_height = (height*width*3)-((row+i)*width - col) * 3;
  319. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red);
  320. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + pkt_off*GetPixelChannels(LD->image)));
  321. /* R */
  322. hcalc = alpha_blending(buffer[buf_off_xpos +0], buffer[buf_off_width +0], alpha_hori);
  323. vcalc = alpha_blending(buffer[buf_off_ypos +0], buffer[buf_off_height +0], alpha_vert);
  324. @@ -405,7 +407,7 @@
  325. * instance filter instance
  326. * @return void nothing
  327. *********************************************************/
  328. -static void work_with_yuv_frame(logoaway_data *LD, char *buffer, int width, int height)
  329. +static void work_with_yuv_frame(logoaway_data *LD, unsigned char *buffer, int width, int height)
  330. {
  331. int row, col, i;
  332. int craddr, cbaddr;
  333. @@ -431,10 +433,11 @@
  334. buf_off = row*width+col;
  335. pkt_off = (row-LD->ypos) * (LD->width-LD->xpos) + (col-LD->xpos);
  336. + Quantum *pixel = LD->pixel_packet + pkt_off*GetPixelChannels(LD->image);
  337. if (!LD->alpha) {
  338. buffer[buf_off] = LD->ycolor;
  339. } else {
  340. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red);
  341. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, pixel));
  342. buffer[buf_off] = alpha_blending(buffer[buf_off], LD->ycolor, alpha_px);
  343. }
  344. }
  345. @@ -446,8 +449,9 @@
  346. buf_off = row*width/2+col;
  347. pkt_off = (row*2-LD->ypos) * (LD->width-LD->xpos) + (col*2-LD->xpos);
  348. + Quantum *pixel = LD->pixel_packet + pkt_off*GetPixelChannels(LD->image);
  349. /* sic */
  350. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red);
  351. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, pixel));
  352. if (!LD->alpha) {
  353. buffer[craddr + buf_off] = LD->ucolor;
  354. buffer[cbaddr + buf_off] = LD->vcolor;
  355. @@ -483,10 +487,11 @@
  356. buf_off_height = LD->height*width+col;
  357. pkt_off = (row-LD->ypos) * (LD->width-LD->xpos) + (col-LD->xpos);
  358. + Quantum *pixel = LD->pixel_packet + pkt_off*GetPixelChannels(LD->image);
  359. hcalc = alpha_blending(buffer[buf_off_xpos], buffer[buf_off_width], alpha_hori);
  360. vcalc = alpha_blending(buffer[buf_off_ypos], buffer[buf_off_height], alpha_vert);
  361. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red);
  362. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, pixel));
  363. new_px = (hcalc*LD->xweight + vcalc*LD->yweight)/100;
  364. if (!LD->alpha) {
  365. buffer[buf_off] = new_px;
  366. @@ -517,7 +522,8 @@
  367. buf_off_height = LD->height/2*width/2+col;
  368. pkt_off = (row*2-LD->ypos) * (LD->width-LD->xpos) + (col*2-LD->xpos);
  369. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red);
  370. + Quantum *pixel = LD->pixel_packet + pkt_off*GetPixelChannels(LD->image);
  371. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, pixel));
  372. /* sic, reuse red alpha_px */
  373. hcalc = alpha_blending(buffer[craddr + buf_off_xpos], buffer[craddr + buf_off_width], alpha_hori);
  374. @@ -560,30 +566,30 @@
  375. pkt_off = (row-LD->ypos) * (LD->width-LD->xpos) + (col-LD->xpos);
  376. i = 0;
  377. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off-i].red);
  378. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off-i)*GetPixelChannels(LD->image)));
  379. while ((alpha_px != 255) && (col-i>LD->xpos))
  380. i++;
  381. buf_off_xpos = (row*width + col-i);
  382. i = 0;
  383. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off+i].red);
  384. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off+i)*GetPixelChannels(LD->image)));
  385. while ((alpha_px != 255) && (col+i<LD->width))
  386. i++;
  387. buf_off_width = (row*width + col+i);
  388. i = 0;
  389. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off-i*(LD->width-LD->xpos)].red);
  390. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off-i*(LD->width-LD->xpos))*GetPixelChannels(LD->image)));
  391. while ((alpha_px != 255) && (row-i>LD->ypos))
  392. i++;
  393. buf_off_ypos = ((row-i)*width + col);
  394. i = 0;
  395. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off+i*(LD->width-LD->xpos)].red);
  396. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off+i*(LD->width-LD->xpos))*GetPixelChannels(LD->image)));
  397. while ((alpha_px != 255) && (row+i<LD->height))
  398. i++;
  399. buf_off_height = ((row+i)*width + col);
  400. hcalc = alpha_blending( buffer[buf_off_xpos], buffer[buf_off_width], alpha_hori );
  401. vcalc = alpha_blending( buffer[buf_off_ypos], buffer[buf_off_height], alpha_vert );
  402. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red);
  403. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + pkt_off*GetPixelChannels(LD->image)));
  404. new_px = (hcalc*LD->xweight + vcalc*LD->yweight)/100;
  405. buffer[buf_off] = alpha_blending(buffer[buf_off], new_px, alpha_px);
  406. }
  407. @@ -603,23 +609,23 @@
  408. alpha_hori = xdistance * distance_west;
  409. i = 0;
  410. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off-i].red);
  411. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off-i)*GetPixelChannels(LD->image)));
  412. while ((alpha_px != 255) && (col-i>LD->xpos))
  413. i++;
  414. buf_off_xpos = (row*width/2 + col-i);
  415. i = 0;
  416. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off+i].red);
  417. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off+i)*GetPixelChannels(LD->image)));
  418. while ((alpha_px != 255) && (col+i<LD->width))
  419. i++;
  420. buf_off_width = (row*width/2 + col+i);
  421. i = 0;
  422. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off-i*(LD->width-LD->xpos)].red);
  423. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off-i*(LD->width-LD->xpos))*GetPixelChannels(LD->image)));
  424. while ((alpha_px != 255) && (row-i>LD->ypos))
  425. i++;
  426. buf_off_ypos = ((row-i)*width/2 + col);
  427. i = 0;
  428. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off+i*(LD->width-LD->xpos)].red);
  429. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + (pkt_off+i*(LD->width-LD->xpos))*GetPixelChannels(LD->image)));
  430. while ((alpha_px != 255) && (row+i<LD->height))
  431. i++;
  432. buf_off_height = ((row+i)*width/2 + col);
  433. @@ -630,7 +636,7 @@
  434. pkt_off = (row*2-LD->ypos) * (LD->width-LD->xpos) + (col*2-LD->xpos);
  435. - alpha_px = (uint8_t)ScaleQuantumToChar(LD->pixel_packet[pkt_off].red);
  436. + alpha_px = (uint8_t)ScaleQuantumToChar(GetPixelRed(LD->image, LD->pixel_packet + pkt_off*GetPixelChannels(LD->image)));
  437. /* sic: reuse the red component */
  438. hcalc = alpha_blending(buffer[craddr + buf_off_xpos], buffer[craddr + buf_off_width], alpha_hori);
  439. vcalc = alpha_blending(buffer[craddr + buf_off_ypos], buffer[craddr + buf_off_height], alpha_vert);
  440. @@ -815,17 +821,17 @@
  441. }
  442. if((data[instance]->alpha) || (data[instance]->dump)) {
  443. - InitializeMagick("");
  444. - GetExceptionInfo(&data[instance]->exception_info);
  445. + MagickCoreGenesis("", MagickFalse);
  446. + data[instance]->exception_info = AcquireExceptionInfo();
  447. if(data[instance]->alpha) {
  448. data[instance]->image_info = CloneImageInfo((ImageInfo *) NULL);
  449. strlcpy(data[instance]->image_info->filename, data[instance]->file, MaxTextExtent);
  450. - data[instance]->image = ReadImage(data[instance]->image_info, &data[instance]->exception_info);
  451. + data[instance]->image = ReadImage(data[instance]->image_info, data[instance]->exception_info);
  452. if (data[instance]->image == (Image *) NULL) {
  453. tc_log_error(MOD_NAME, "\n");
  454. - MagickWarning (data[instance]->exception_info.severity, data[instance]->exception_info.reason, data[instance]->exception_info.description);
  455. + MagickWarning (data[instance]->exception_info->severity, data[instance]->exception_info->reason, data[instance]->exception_info->description);
  456. return TC_ERROR;
  457. }
  458. @@ -835,7 +841,7 @@
  459. return TC_ERROR;
  460. }
  461. - data[instance]->pixel_packet = GetImagePixels(data[instance]->image, 0, 0, data[instance]->image->columns, data[instance]->image->rows);
  462. + data[instance]->pixel_packet = GetAuthenticPixels(data[instance]->image, 0, 0, data[instance]->image->columns, data[instance]->image->rows, data[instance]->exception_info);
  463. }
  464. if(data[instance]->dump) {
  465. if((data[instance]->dump_buf = tc_malloc ((data[instance]->width-data[instance]->xpos)*(data[instance]->height-data[instance]->ypos)*3)) == NULL)
  466. @@ -865,10 +871,9 @@
  467. if (data[instance]->dumpimage != (Image *)NULL) {
  468. DestroyImage(data[instance]->dumpimage);
  469. DestroyImageInfo(data[instance]->dumpimage_info);
  470. - ConstituteComponentTerminus();
  471. }
  472. - DestroyExceptionInfo(&data[instance]->exception_info);
  473. - DestroyMagick();
  474. + DestroyExceptionInfo(data[instance]->exception_info);
  475. + MagickCoreTerminus();
  476. if(data[instance]->dump_buf) free(data[instance]->dump_buf);
  477. if(data[instance]) free(data[instance]);
  478. --- transcode-1.1.7/filter/filter_logo.c
  479. +++ transcode-1.1.7/filter/filter_logo.c
  480. @@ -36,7 +36,7 @@
  481. /* Note: because of ImageMagick bogosity, this must be included first, so
  482. * we can undefine the PACKAGE_* symbols it splats into our namespace */
  483. -#include <magick/api.h>
  484. +#include <MagickCore/MagickCore.h>
  485. #undef PACKAGE_BUGREPORT
  486. #undef PACKAGE_NAME
  487. #undef PACKAGE_STRING
  488. @@ -227,7 +227,8 @@
  489. ImageFormat ifmt,
  490. int do_rgbswap)
  491. {
  492. - PixelPacket *pixel_packet;
  493. + ExceptionInfo *exception_info;
  494. + Quantum *pixel_packet;
  495. uint8_t *dst_ptr = dst;
  496. int row, col;
  497. @@ -246,16 +247,17 @@
  498. }
  499. g_off = 1;
  500. - pixel_packet = GetImagePixels(src, 0, 0, width, height);
  501. + exception_info = AcquireExceptionInfo();
  502. + pixel_packet = GetAuthenticPixels(src, 0, 0, width, height, exception_info);
  503. for (row = 0; row < height; row++) {
  504. for (col = 0; col < width; col++) {
  505. - *(dst_ptr + r_off) = (uint8_t)ScaleQuantumToChar(pixel_packet->red);
  506. - *(dst_ptr + g_off) = (uint8_t)ScaleQuantumToChar(pixel_packet->green);
  507. - *(dst_ptr + b_off) = (uint8_t)ScaleQuantumToChar(pixel_packet->blue);
  508. + *(dst_ptr + r_off) = (uint8_t)ScaleQuantumToChar(GetPixelRed(src, pixel_packet));
  509. + *(dst_ptr + g_off) = (uint8_t)ScaleQuantumToChar(GetPixelGreen(src, pixel_packet));
  510. + *(dst_ptr + b_off) = (uint8_t)ScaleQuantumToChar(GetPixelBlue(src, pixel_packet));
  511. dst_ptr += 3;
  512. - pixel_packet++;
  513. + pixel_packet += GetPixelChannels(src);
  514. }
  515. }
  516. @@ -310,7 +312,7 @@
  517. Image *timg;
  518. Image *nimg;
  519. ImageInfo *image_info;
  520. - ExceptionInfo exception_info;
  521. + ExceptionInfo *exception_info;
  522. int rgb_off = 0;
  523. @@ -376,19 +378,19 @@
  524. * semaphore.
  525. */
  526. magick_usecount++;
  527. - if (!IsMagickInstantiated()) {
  528. - InitializeMagick("");
  529. + if (!IsMagickCoreInstantiated()) {
  530. + MagickCoreGenesis("", MagickFalse);
  531. }
  532. - GetExceptionInfo(&exception_info);
  533. + exception_info = AcquireExceptionInfo();
  534. image_info = CloneImageInfo((ImageInfo *) NULL);
  535. strlcpy(image_info->filename, mfd->file, MaxTextExtent);
  536. - mfd->image = ReadImage(image_info, &exception_info);
  537. + mfd->image = ReadImage(image_info, exception_info);
  538. if (mfd->image == (Image *) NULL) {
  539. - MagickWarning(exception_info.severity,
  540. - exception_info.reason,
  541. - exception_info.description);
  542. + MagickWarning(exception_info->severity,
  543. + exception_info->reason,
  544. + exception_info->description);
  545. strlcpy(mfd->file, "/dev/null", PATH_MAX);
  546. return 0;
  547. }
  548. @@ -413,11 +415,11 @@
  549. while (mfd->images != (Image *)NULL) {
  550. if (mfd->flip || flip) {
  551. - timg = FlipImage(mfd->images, &exception_info);
  552. + timg = FlipImage(mfd->images, exception_info);
  553. if (timg == (Image *) NULL) {
  554. - MagickError(exception_info.severity,
  555. - exception_info.reason,
  556. - exception_info.description);
  557. + MagickError(exception_info->severity,
  558. + exception_info->reason,
  559. + exception_info->description);
  560. return -1;
  561. }
  562. AppendImageToList(&nimg, timg);
  563. @@ -573,7 +575,7 @@
  564. /* Set up image/video coefficient lookup tables */
  565. if (img_coeff_lookup[0] < 0) {
  566. int i;
  567. - float maxrgbval = (float)MaxRGB; // from ImageMagick
  568. + float maxrgbval = (float)QuantumRange; // from ImageMagick
  569. for (i = 0; i <= MAX_UINT8_VAL; i++) {
  570. float x = (float)ScaleCharToQuantum(i);
  571. @@ -615,8 +617,8 @@
  572. }
  573. magick_usecount--;
  574. - if (magick_usecount == 0 && IsMagickInstantiated()) {
  575. - DestroyMagick();
  576. + if (magick_usecount == 0 && IsMagickCoreInstantiated()) {
  577. + MagickCoreTerminus();
  578. }
  579. return 0;
  580. @@ -638,7 +640,8 @@
  581. && (ptr->tag & TC_VIDEO)
  582. && !(ptr->attributes & TC_FRAME_IS_SKIPPED)
  583. ) {
  584. - PixelPacket *pixel_packet;
  585. + ExceptionInfo *exception_info;
  586. + Quantum *pixel_packet;
  587. uint8_t *video_buf;
  588. int do_fade = 0;
  589. @@ -647,6 +650,7 @@
  590. /* Note: ImageMagick defines opacity = 0 as fully visible, and
  591. * opacity = MaxRGB as fully transparent.
  592. + * alpha rather than opacity (0 transparent; QuantumRange opaque).
  593. */
  594. Quantum opacity;
  595. @@ -682,9 +686,11 @@
  596. mfd->cur_delay = mfd->images->delay * vob->fps/100;
  597. }
  598. - pixel_packet = GetImagePixels(mfd->images, 0, 0,
  599. + exception_info = AcquireExceptionInfo();
  600. + pixel_packet = GetAuthenticPixels(mfd->images, 0, 0,
  601. mfd->images->columns,
  602. - mfd->images->rows);
  603. + mfd->images->rows,
  604. + exception_info);
  605. if (vob->im_v_codec == CODEC_RGB) {
  606. unsigned long r_off, g_off, b_off;
  607. @@ -702,30 +708,30 @@
  608. video_buf = ptr->video_buf + 3 * ((row + mfd->posy) * vob->ex_v_width + mfd->posx);
  609. for (col = 0; col < mfd->image->columns; col++) {
  610. - opacity = pixel_packet->opacity;
  611. + opacity = QuantumRange - GetPixelAlpha(mfd->images, pixel_packet);
  612. if (do_fade)
  613. - opacity += (Quantum)((MaxRGB - opacity) * fade_coeff);
  614. + opacity += (Quantum)((QuantumRange - opacity) * fade_coeff);
  615. if (opacity == 0) {
  616. - *(video_buf + r_off) = ScaleQuantumToChar(pixel_packet->red);
  617. - *(video_buf + g_off) = ScaleQuantumToChar(pixel_packet->green);
  618. - *(video_buf + b_off) = ScaleQuantumToChar(pixel_packet->blue);
  619. - } else if (opacity < MaxRGB) {
  620. + *(video_buf + r_off) = ScaleQuantumToChar(GetPixelRed(mfd->images, pixel_packet));
  621. + *(video_buf + g_off) = ScaleQuantumToChar(GetPixelGreen(mfd->images, pixel_packet));
  622. + *(video_buf + b_off) = ScaleQuantumToChar(GetPixelBlue(mfd->images, pixel_packet));
  623. + } else if (opacity < QuantumRange) {
  624. unsigned char opacity_uchar = ScaleQuantumToChar(opacity);
  625. img_coeff = img_coeff_lookup[opacity_uchar];
  626. vid_coeff = vid_coeff_lookup[opacity_uchar];
  627. *(video_buf + r_off) = (uint8_t)((*(video_buf + r_off)) * vid_coeff)
  628. - + (uint8_t)(ScaleQuantumToChar(pixel_packet->red) * img_coeff);
  629. + + (uint8_t)(ScaleQuantumToChar(GetPixelRed(mfd->images, pixel_packet)) * img_coeff);
  630. *(video_buf + g_off) = (uint8_t)((*(video_buf + g_off)) * vid_coeff)
  631. - + (uint8_t)(ScaleQuantumToChar(pixel_packet->green) * img_coeff);
  632. + + (uint8_t)(ScaleQuantumToChar(GetPixelGreen(mfd->images, pixel_packet)) * img_coeff);
  633. *(video_buf + b_off) = (uint8_t)((*(video_buf + b_off)) * vid_coeff)
  634. - + (uint8_t)(ScaleQuantumToChar(pixel_packet->blue) * img_coeff);
  635. + + (uint8_t)(ScaleQuantumToChar(GetPixelBlue(mfd->images, pixel_packet)) * img_coeff);
  636. }
  637. video_buf += 3;
  638. - pixel_packet++;
  639. + pixel_packet += GetPixelChannels(mfd->images);
  640. }
  641. }
  642. } else { /* !RGB */
  643. @@ -745,10 +751,10 @@
  644. vid_pixel_V = vid_pixel_U + vid_size/4;
  645. for (col = 0; col < mfd->images->columns; col++) {
  646. int do_UV_pixels = (mfd->grayout == 0 && !(row % 2) && !(col % 2)) ? 1 : 0;
  647. - opacity = pixel_packet->opacity;
  648. + opacity = QuantumRange - GetPixelAlpha(mfd->images, pixel_packet);
  649. if (do_fade)
  650. - opacity += (Quantum)((MaxRGB - opacity) * fade_coeff);
  651. + opacity += (Quantum)((QuantumRange - opacity) * fade_coeff);
  652. if (opacity == 0) {
  653. *vid_pixel_Y = *img_pixel_Y;
  654. @@ -756,7 +762,7 @@
  655. *vid_pixel_U = *img_pixel_U;
  656. *vid_pixel_V = *img_pixel_V;
  657. }
  658. - } else if (opacity < MaxRGB) {
  659. + } else if (opacity < QuantumRange) {
  660. unsigned char opacity_uchar = ScaleQuantumToChar(opacity);
  661. img_coeff = img_coeff_lookup[opacity_uchar];
  662. vid_coeff = vid_coeff_lookup[opacity_uchar];
  663. --- transcode-1.1.7/import/import_im.c
  664. +++ transcode-1.1.7/import/import_im.c
  665. @@ -34,9 +34,9 @@
  666. /* Note: because of ImageMagick bogosity, this must be included first, so
  667. * we can undefine the PACKAGE_* symbols it splats into our namespace */
  668. #ifdef HAVE_BROKEN_WAND
  669. -#include <wand/magick-wand.h>
  670. +#include <MagickWand/MagickWand.h>
  671. #else /* we have a SANE wand header */
  672. -#include <wand/MagickWand.h>
  673. +#include <MagickWand/MagickWand.h>
  674. #endif /* HAVE_BROKEN_WAND */
  675. #undef PACKAGE_BUGREPORT
  676. --- transcode-1.1.7/import/import_imlist.c
  677. +++ transcode-1.1.7/import/import_imlist.c
  678. @@ -34,9 +34,9 @@
  679. /* Note: because of ImageMagick bogosity, this must be included first, so
  680. * we can undefine the PACKAGE_* symbols it splats into our namespace */
  681. #ifdef HAVE_BROKEN_WAND
  682. -#include <wand/magick-wand.h>
  683. +#include <MagickWand/MagickWand.h>
  684. #else /* we have a SANE wand header */
  685. -#include <wand/MagickWand.h>
  686. +#include <MagickWand/MagickWand.h>
  687. #endif /* HAVE_BROKEN_WAND */
  688. #undef PACKAGE_BUGREPORT
  689. --- transcode-1.1.7/import/probe_im.c
  690. +++ transcode-1.1.7/import/probe_im.c
  691. @@ -40,9 +40,9 @@
  692. # undef PACKAGE_VERSION
  693. # ifdef HAVE_BROKEN_WAND
  694. -# include <wand/magick-wand.h>
  695. +# include <MagickWand/MagickWand.h>
  696. # else /* we have a SANE wand header */
  697. -# include <wand/MagickWand.h>
  698. +# include <MagickWand/MagickWand.h>
  699. # endif /* HAVE_BROKEN_WAND */
  700. # undef PACKAGE_BUGREPORT