2 * Copyright 2009 Vincent Povirk for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "wine/port.h"
31 /* This is a hack, so jpeglib.h does not redefine INT32 and the like*/
33 #define UINT8 JPEG_UINT8
34 #define UINT16 JPEG_UINT16
35 #define boolean jpeg_boolean
39 #define HAVE_STDLIB_H 1
52 #include "wincodecs_private.h"
54 #include "wine/debug.h"
55 #include "wine/library.h"
57 WINE_DEFAULT_DEBUG_CHANNEL(wincodecs
);
60 WINE_DECLARE_DEBUG_CHANNEL(jpeg
);
62 static void *libjpeg_handle
;
64 #define MAKE_FUNCPTR(f) static typeof(f) * p##f
65 MAKE_FUNCPTR(jpeg_CreateDecompress
);
66 MAKE_FUNCPTR(jpeg_destroy_decompress
);
67 MAKE_FUNCPTR(jpeg_read_header
);
68 MAKE_FUNCPTR(jpeg_read_scanlines
);
69 MAKE_FUNCPTR(jpeg_resync_to_restart
);
70 MAKE_FUNCPTR(jpeg_start_decompress
);
71 MAKE_FUNCPTR(jpeg_std_error
);
74 static void *load_libjpeg(void)
76 if((libjpeg_handle
= wine_dlopen(SONAME_LIBJPEG
, RTLD_NOW
, NULL
, 0)) != NULL
) {
78 #define LOAD_FUNCPTR(f) \
79 if((p##f = wine_dlsym(libjpeg_handle, #f, NULL, 0)) == NULL) { \
80 libjpeg_handle = NULL; \
84 LOAD_FUNCPTR(jpeg_CreateDecompress
);
85 LOAD_FUNCPTR(jpeg_destroy_decompress
);
86 LOAD_FUNCPTR(jpeg_read_header
);
87 LOAD_FUNCPTR(jpeg_read_scanlines
);
88 LOAD_FUNCPTR(jpeg_resync_to_restart
);
89 LOAD_FUNCPTR(jpeg_start_decompress
);
90 LOAD_FUNCPTR(jpeg_std_error
);
93 return libjpeg_handle
;
96 static void error_exit_fn(j_common_ptr cinfo
)
98 char message
[JMSG_LENGTH_MAX
];
101 cinfo
->err
->format_message(cinfo
, message
);
102 ERR_(jpeg
)("%s\n", message
);
104 longjmp(*(jmp_buf*)cinfo
->client_data
, 1);
107 static void emit_message_fn(j_common_ptr cinfo
, int msg_level
)
109 char message
[JMSG_LENGTH_MAX
];
111 if (msg_level
< 0 && ERR_ON(jpeg
))
113 cinfo
->err
->format_message(cinfo
, message
);
114 ERR_(jpeg
)("%s\n", message
);
116 else if (msg_level
== 0 && WARN_ON(jpeg
))
118 cinfo
->err
->format_message(cinfo
, message
);
119 WARN_(jpeg
)("%s\n", message
);
121 else if (msg_level
> 0 && TRACE_ON(jpeg
))
123 cinfo
->err
->format_message(cinfo
, message
);
124 TRACE_(jpeg
)("%s\n", message
);
129 IWICBitmapDecoder IWICBitmapDecoder_iface
;
130 IWICBitmapFrameDecode IWICBitmapFrameDecode_iface
;
133 BOOL cinfo_initialized
;
135 struct jpeg_decompress_struct cinfo
;
136 struct jpeg_error_mgr jerr
;
137 struct jpeg_source_mgr source_mgr
;
138 BYTE source_buffer
[1024];
140 CRITICAL_SECTION lock
;
143 static inline JpegDecoder
*impl_from_IWICBitmapDecoder(IWICBitmapDecoder
*iface
)
145 return CONTAINING_RECORD(iface
, JpegDecoder
, IWICBitmapDecoder_iface
);
148 static inline JpegDecoder
*impl_from_IWICBitmapFrameDecode(IWICBitmapFrameDecode
*iface
)
150 return CONTAINING_RECORD(iface
, JpegDecoder
, IWICBitmapFrameDecode_iface
);
153 static inline JpegDecoder
*decoder_from_decompress(j_decompress_ptr decompress
)
155 return CONTAINING_RECORD(decompress
, JpegDecoder
, cinfo
);
158 static HRESULT WINAPI
JpegDecoder_QueryInterface(IWICBitmapDecoder
*iface
, REFIID iid
,
161 JpegDecoder
*This
= impl_from_IWICBitmapDecoder(iface
);
162 TRACE("(%p,%s,%p)\n", iface
, debugstr_guid(iid
), ppv
);
164 if (!ppv
) return E_INVALIDARG
;
166 if (IsEqualIID(&IID_IUnknown
, iid
) || IsEqualIID(&IID_IWICBitmapDecoder
, iid
))
173 return E_NOINTERFACE
;
176 IUnknown_AddRef((IUnknown
*)*ppv
);
180 static ULONG WINAPI
JpegDecoder_AddRef(IWICBitmapDecoder
*iface
)
182 JpegDecoder
*This
= impl_from_IWICBitmapDecoder(iface
);
183 ULONG ref
= InterlockedIncrement(&This
->ref
);
185 TRACE("(%p) refcount=%u\n", iface
, ref
);
190 static ULONG WINAPI
JpegDecoder_Release(IWICBitmapDecoder
*iface
)
192 JpegDecoder
*This
= impl_from_IWICBitmapDecoder(iface
);
193 ULONG ref
= InterlockedDecrement(&This
->ref
);
195 TRACE("(%p) refcount=%u\n", iface
, ref
);
199 This
->lock
.DebugInfo
->Spare
[0] = 0;
200 DeleteCriticalSection(&This
->lock
);
201 if (This
->cinfo_initialized
) pjpeg_destroy_decompress(&This
->cinfo
);
202 if (This
->stream
) IStream_Release(This
->stream
);
203 HeapFree(GetProcessHeap(), 0, This
->image_data
);
204 HeapFree(GetProcessHeap(), 0, This
);
210 static HRESULT WINAPI
JpegDecoder_QueryCapability(IWICBitmapDecoder
*iface
, IStream
*pIStream
,
211 DWORD
*pdwCapability
)
213 FIXME("(%p,%p,%p): stub\n", iface
, pIStream
, pdwCapability
);
217 static void source_mgr_init_source(j_decompress_ptr cinfo
)
221 static jpeg_boolean
source_mgr_fill_input_buffer(j_decompress_ptr cinfo
)
223 JpegDecoder
*This
= decoder_from_decompress(cinfo
);
227 hr
= IStream_Read(This
->stream
, This
->source_buffer
, 1024, &bytesread
);
229 if (hr
!= S_OK
|| bytesread
== 0)
235 This
->source_mgr
.next_input_byte
= This
->source_buffer
;
236 This
->source_mgr
.bytes_in_buffer
= bytesread
;
241 static void source_mgr_skip_input_data(j_decompress_ptr cinfo
, long num_bytes
)
243 JpegDecoder
*This
= decoder_from_decompress(cinfo
);
246 if (num_bytes
> This
->source_mgr
.bytes_in_buffer
)
248 seek
.QuadPart
= num_bytes
- This
->source_mgr
.bytes_in_buffer
;
249 IStream_Seek(This
->stream
, seek
, STREAM_SEEK_CUR
, NULL
);
250 This
->source_mgr
.bytes_in_buffer
= 0;
252 else if (num_bytes
> 0)
254 This
->source_mgr
.next_input_byte
+= num_bytes
;
255 This
->source_mgr
.bytes_in_buffer
-= num_bytes
;
259 static void source_mgr_term_source(j_decompress_ptr cinfo
)
263 static HRESULT WINAPI
JpegDecoder_Initialize(IWICBitmapDecoder
*iface
, IStream
*pIStream
,
264 WICDecodeOptions cacheOptions
)
266 JpegDecoder
*This
= impl_from_IWICBitmapDecoder(iface
);
270 TRACE("(%p,%p,%u)\n", iface
, pIStream
, cacheOptions
);
272 EnterCriticalSection(&This
->lock
);
274 if (This
->cinfo_initialized
)
276 LeaveCriticalSection(&This
->lock
);
277 return WINCODEC_ERR_WRONGSTATE
;
280 pjpeg_std_error(&This
->jerr
);
282 This
->jerr
.error_exit
= error_exit_fn
;
283 This
->jerr
.emit_message
= emit_message_fn
;
285 This
->cinfo
.err
= &This
->jerr
;
287 This
->cinfo
.client_data
= jmpbuf
;
291 LeaveCriticalSection(&This
->lock
);
295 pjpeg_CreateDecompress(&This
->cinfo
, JPEG_LIB_VERSION
, sizeof(struct jpeg_decompress_struct
));
297 This
->cinfo_initialized
= TRUE
;
299 This
->stream
= pIStream
;
300 IStream_AddRef(pIStream
);
303 IStream_Seek(This
->stream
, seek
, STREAM_SEEK_SET
, NULL
);
305 This
->source_mgr
.bytes_in_buffer
= 0;
306 This
->source_mgr
.init_source
= source_mgr_init_source
;
307 This
->source_mgr
.fill_input_buffer
= source_mgr_fill_input_buffer
;
308 This
->source_mgr
.skip_input_data
= source_mgr_skip_input_data
;
309 This
->source_mgr
.resync_to_restart
= pjpeg_resync_to_restart
;
310 This
->source_mgr
.term_source
= source_mgr_term_source
;
312 This
->cinfo
.src
= &This
->source_mgr
;
314 ret
= pjpeg_read_header(&This
->cinfo
, TRUE
);
316 if (ret
!= JPEG_HEADER_OK
) {
317 WARN("Jpeg image in stream has bad format, read header returned %d.\n",ret
);
318 LeaveCriticalSection(&This
->lock
);
322 switch (This
->cinfo
.jpeg_color_space
)
325 This
->cinfo
.out_color_space
= JCS_GRAYSCALE
;
329 This
->cinfo
.out_color_space
= JCS_RGB
;
333 This
->cinfo
.out_color_space
= JCS_CMYK
;
336 ERR("Unknown JPEG color space %i\n", This
->cinfo
.jpeg_color_space
);
337 LeaveCriticalSection(&This
->lock
);
341 if (!pjpeg_start_decompress(&This
->cinfo
))
343 ERR("jpeg_start_decompress failed\n");
344 LeaveCriticalSection(&This
->lock
);
348 This
->initialized
= TRUE
;
350 LeaveCriticalSection(&This
->lock
);
355 static HRESULT WINAPI
JpegDecoder_GetContainerFormat(IWICBitmapDecoder
*iface
,
356 GUID
*pguidContainerFormat
)
358 memcpy(pguidContainerFormat
, &GUID_ContainerFormatJpeg
, sizeof(GUID
));
362 static HRESULT WINAPI
JpegDecoder_GetDecoderInfo(IWICBitmapDecoder
*iface
,
363 IWICBitmapDecoderInfo
**ppIDecoderInfo
)
366 IWICComponentInfo
*compinfo
;
368 TRACE("(%p,%p)\n", iface
, ppIDecoderInfo
);
370 hr
= CreateComponentInfo(&CLSID_WICJpegDecoder
, &compinfo
);
371 if (FAILED(hr
)) return hr
;
373 hr
= IWICComponentInfo_QueryInterface(compinfo
, &IID_IWICBitmapDecoderInfo
,
374 (void**)ppIDecoderInfo
);
376 IWICComponentInfo_Release(compinfo
);
381 static HRESULT WINAPI
JpegDecoder_CopyPalette(IWICBitmapDecoder
*iface
,
382 IWICPalette
*pIPalette
)
384 TRACE("(%p,%p)\n", iface
, pIPalette
);
386 return WINCODEC_ERR_PALETTEUNAVAILABLE
;
389 static HRESULT WINAPI
JpegDecoder_GetMetadataQueryReader(IWICBitmapDecoder
*iface
,
390 IWICMetadataQueryReader
**ppIMetadataQueryReader
)
392 FIXME("(%p,%p): stub\n", iface
, ppIMetadataQueryReader
);
396 static HRESULT WINAPI
JpegDecoder_GetPreview(IWICBitmapDecoder
*iface
,
397 IWICBitmapSource
**ppIBitmapSource
)
399 FIXME("(%p,%p): stub\n", iface
, ppIBitmapSource
);
400 return WINCODEC_ERR_UNSUPPORTEDOPERATION
;
403 static HRESULT WINAPI
JpegDecoder_GetColorContexts(IWICBitmapDecoder
*iface
,
404 UINT cCount
, IWICColorContext
**ppIColorContexts
, UINT
*pcActualCount
)
406 FIXME("(%p,%u,%p,%p): stub\n", iface
, cCount
, ppIColorContexts
, pcActualCount
);
407 return WINCODEC_ERR_UNSUPPORTEDOPERATION
;
410 static HRESULT WINAPI
JpegDecoder_GetThumbnail(IWICBitmapDecoder
*iface
,
411 IWICBitmapSource
**ppIThumbnail
)
413 FIXME("(%p,%p): stub\n", iface
, ppIThumbnail
);
414 return WINCODEC_ERR_CODECNOTHUMBNAIL
;
417 static HRESULT WINAPI
JpegDecoder_GetFrameCount(IWICBitmapDecoder
*iface
,
424 static HRESULT WINAPI
JpegDecoder_GetFrame(IWICBitmapDecoder
*iface
,
425 UINT index
, IWICBitmapFrameDecode
**ppIBitmapFrame
)
427 JpegDecoder
*This
= impl_from_IWICBitmapDecoder(iface
);
428 TRACE("(%p,%u,%p)\n", iface
, index
, ppIBitmapFrame
);
430 if (!This
->initialized
) return WINCODEC_ERR_NOTINITIALIZED
;
432 if (index
!= 0) return E_INVALIDARG
;
434 IWICBitmapDecoder_AddRef(iface
);
435 *ppIBitmapFrame
= &This
->IWICBitmapFrameDecode_iface
;
440 static const IWICBitmapDecoderVtbl JpegDecoder_Vtbl
= {
441 JpegDecoder_QueryInterface
,
444 JpegDecoder_QueryCapability
,
445 JpegDecoder_Initialize
,
446 JpegDecoder_GetContainerFormat
,
447 JpegDecoder_GetDecoderInfo
,
448 JpegDecoder_CopyPalette
,
449 JpegDecoder_GetMetadataQueryReader
,
450 JpegDecoder_GetPreview
,
451 JpegDecoder_GetColorContexts
,
452 JpegDecoder_GetThumbnail
,
453 JpegDecoder_GetFrameCount
,
457 static HRESULT WINAPI
JpegDecoder_Frame_QueryInterface(IWICBitmapFrameDecode
*iface
, REFIID iid
,
460 TRACE("(%p,%s,%p)\n", iface
, debugstr_guid(iid
), ppv
);
462 if (!ppv
) return E_INVALIDARG
;
464 if (IsEqualIID(&IID_IUnknown
, iid
) ||
465 IsEqualIID(&IID_IWICBitmapSource
, iid
) ||
466 IsEqualIID(&IID_IWICBitmapFrameDecode
, iid
))
473 return E_NOINTERFACE
;
476 IUnknown_AddRef((IUnknown
*)*ppv
);
480 static ULONG WINAPI
JpegDecoder_Frame_AddRef(IWICBitmapFrameDecode
*iface
)
482 JpegDecoder
*This
= impl_from_IWICBitmapFrameDecode(iface
);
483 return IUnknown_AddRef((IUnknown
*)This
);
486 static ULONG WINAPI
JpegDecoder_Frame_Release(IWICBitmapFrameDecode
*iface
)
488 JpegDecoder
*This
= impl_from_IWICBitmapFrameDecode(iface
);
489 return IUnknown_Release((IUnknown
*)This
);
492 static HRESULT WINAPI
JpegDecoder_Frame_GetSize(IWICBitmapFrameDecode
*iface
,
493 UINT
*puiWidth
, UINT
*puiHeight
)
495 JpegDecoder
*This
= impl_from_IWICBitmapFrameDecode(iface
);
496 *puiWidth
= This
->cinfo
.output_width
;
497 *puiHeight
= This
->cinfo
.output_height
;
498 TRACE("(%p)->(%u,%u)\n", iface
, *puiWidth
, *puiHeight
);
502 static HRESULT WINAPI
JpegDecoder_Frame_GetPixelFormat(IWICBitmapFrameDecode
*iface
,
503 WICPixelFormatGUID
*pPixelFormat
)
505 JpegDecoder
*This
= impl_from_IWICBitmapFrameDecode(iface
);
506 TRACE("(%p,%p)\n", iface
, pPixelFormat
);
507 if (This
->cinfo
.out_color_space
== JCS_RGB
)
508 memcpy(pPixelFormat
, &GUID_WICPixelFormat24bppBGR
, sizeof(GUID
));
509 else if (This
->cinfo
.out_color_space
== JCS_CMYK
)
510 memcpy(pPixelFormat
, &GUID_WICPixelFormat32bppCMYK
, sizeof(GUID
));
511 else /* This->cinfo.out_color_space == JCS_GRAYSCALE */
512 memcpy(pPixelFormat
, &GUID_WICPixelFormat8bppGray
, sizeof(GUID
));
516 static HRESULT WINAPI
JpegDecoder_Frame_GetResolution(IWICBitmapFrameDecode
*iface
,
517 double *pDpiX
, double *pDpiY
)
519 FIXME("(%p,%p,%p): stub\n", iface
, pDpiX
, pDpiY
);
523 static HRESULT WINAPI
JpegDecoder_Frame_CopyPalette(IWICBitmapFrameDecode
*iface
,
524 IWICPalette
*pIPalette
)
526 FIXME("(%p,%p): stub\n", iface
, pIPalette
);
530 static HRESULT WINAPI
JpegDecoder_Frame_CopyPixels(IWICBitmapFrameDecode
*iface
,
531 const WICRect
*prc
, UINT cbStride
, UINT cbBufferSize
, BYTE
*pbBuffer
)
533 JpegDecoder
*This
= impl_from_IWICBitmapFrameDecode(iface
);
540 TRACE("(%p,%p,%u,%u,%p)\n", iface
, prc
, cbStride
, cbBufferSize
, pbBuffer
);
546 rect
.Width
= This
->cinfo
.output_width
;
547 rect
.Height
= This
->cinfo
.output_height
;
552 if (prc
->X
< 0 || prc
->Y
< 0 || prc
->X
+prc
->Width
> This
->cinfo
.output_width
||
553 prc
->Y
+prc
->Height
> This
->cinfo
.output_height
)
557 if (This
->cinfo
.out_color_space
== JCS_GRAYSCALE
) bpp
= 8;
558 else if (This
->cinfo
.out_color_space
== JCS_CMYK
) bpp
= 32;
561 stride
= bpp
* This
->cinfo
.output_width
;
562 data_size
= stride
* This
->cinfo
.output_height
;
564 max_row_needed
= prc
->Y
+ prc
->Height
;
565 if (max_row_needed
> This
->cinfo
.output_height
) return E_INVALIDARG
;
567 EnterCriticalSection(&This
->lock
);
569 if (!This
->image_data
)
571 This
->image_data
= HeapAlloc(GetProcessHeap(), 0, data_size
);
572 if (!This
->image_data
)
574 LeaveCriticalSection(&This
->lock
);
575 return E_OUTOFMEMORY
;
579 This
->cinfo
.client_data
= jmpbuf
;
583 LeaveCriticalSection(&This
->lock
);
587 while (max_row_needed
> This
->cinfo
.output_scanline
)
589 UINT first_scanline
= This
->cinfo
.output_scanline
;
591 JSAMPROW out_rows
[4];
595 max_rows
= min(This
->cinfo
.output_height
-first_scanline
, 4);
596 for (i
=0; i
<max_rows
; i
++)
597 out_rows
[i
] = This
->image_data
+ stride
* (first_scanline
+i
);
599 ret
= pjpeg_read_scanlines(&This
->cinfo
, out_rows
, max_rows
);
603 ERR("read_scanlines failed\n");
604 LeaveCriticalSection(&This
->lock
);
610 /* libjpeg gives us RGB data and we want BGR, so byteswap the data */
611 reverse_bgr8(3, This
->image_data
+ stride
* first_scanline
,
612 This
->cinfo
.output_width
, This
->cinfo
.output_scanline
- first_scanline
,
616 if (This
->cinfo
.out_color_space
== JCS_CMYK
&& This
->cinfo
.saw_Adobe_marker
)
617 /* Adobe JPEG's have inverted CMYK data. */
618 for (i
=0; i
<data_size
; i
++)
619 This
->image_data
[i
] ^= 0xff;
622 LeaveCriticalSection(&This
->lock
);
624 return copy_pixels(bpp
, This
->image_data
,
625 This
->cinfo
.output_width
, This
->cinfo
.output_height
, stride
,
626 prc
, cbStride
, cbBufferSize
, pbBuffer
);
629 static HRESULT WINAPI
JpegDecoder_Frame_GetMetadataQueryReader(IWICBitmapFrameDecode
*iface
,
630 IWICMetadataQueryReader
**ppIMetadataQueryReader
)
632 FIXME("(%p,%p): stub\n", iface
, ppIMetadataQueryReader
);
633 return WINCODEC_ERR_UNSUPPORTEDOPERATION
;
636 static HRESULT WINAPI
JpegDecoder_Frame_GetColorContexts(IWICBitmapFrameDecode
*iface
,
637 UINT cCount
, IWICColorContext
**ppIColorContexts
, UINT
*pcActualCount
)
639 FIXME("(%p,%u,%p,%p): stub\n", iface
, cCount
, ppIColorContexts
, pcActualCount
);
640 return WINCODEC_ERR_UNSUPPORTEDOPERATION
;
643 static HRESULT WINAPI
JpegDecoder_Frame_GetThumbnail(IWICBitmapFrameDecode
*iface
,
644 IWICBitmapSource
**ppIThumbnail
)
646 FIXME("(%p,%p): stub\n", iface
, ppIThumbnail
);
647 return WINCODEC_ERR_CODECNOTHUMBNAIL
;
650 static const IWICBitmapFrameDecodeVtbl JpegDecoder_Frame_Vtbl
= {
651 JpegDecoder_Frame_QueryInterface
,
652 JpegDecoder_Frame_AddRef
,
653 JpegDecoder_Frame_Release
,
654 JpegDecoder_Frame_GetSize
,
655 JpegDecoder_Frame_GetPixelFormat
,
656 JpegDecoder_Frame_GetResolution
,
657 JpegDecoder_Frame_CopyPalette
,
658 JpegDecoder_Frame_CopyPixels
,
659 JpegDecoder_Frame_GetMetadataQueryReader
,
660 JpegDecoder_Frame_GetColorContexts
,
661 JpegDecoder_Frame_GetThumbnail
664 HRESULT
JpegDecoder_CreateInstance(IUnknown
*pUnkOuter
, REFIID iid
, void** ppv
)
669 TRACE("(%p,%s,%p)\n", pUnkOuter
, debugstr_guid(iid
), ppv
);
671 if (!libjpeg_handle
&& !load_libjpeg())
673 ERR("Failed reading JPEG because unable to find %s\n", SONAME_LIBJPEG
);
679 if (pUnkOuter
) return CLASS_E_NOAGGREGATION
;
681 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(JpegDecoder
));
682 if (!This
) return E_OUTOFMEMORY
;
684 This
->IWICBitmapDecoder_iface
.lpVtbl
= &JpegDecoder_Vtbl
;
685 This
->IWICBitmapFrameDecode_iface
.lpVtbl
= &JpegDecoder_Frame_Vtbl
;
687 This
->initialized
= FALSE
;
688 This
->cinfo_initialized
= FALSE
;
690 This
->image_data
= NULL
;
691 InitializeCriticalSection(&This
->lock
);
692 This
->lock
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": JpegDecoder.lock");
694 ret
= IUnknown_QueryInterface((IUnknown
*)This
, iid
, ppv
);
695 IUnknown_Release((IUnknown
*)This
);
700 #else /* !defined(SONAME_LIBJPEG) */
702 HRESULT
JpegDecoder_CreateInstance(IUnknown
*pUnkOuter
, REFIID iid
, void** ppv
)
704 ERR("Trying to load JPEG picture, but JPEG support is not compiled in.\n");