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