equal
deleted
inserted
replaced
43 |
43 |
44 #include <qimage.h> |
44 #include <qimage.h> |
45 #include <qvariant.h> |
45 #include <qvariant.h> |
46 #include <qvector.h> |
46 #include <qvector.h> |
47 #include <qbuffer.h> |
47 #include <qbuffer.h> |
|
48 #include <private/qsimd_p.h> |
48 |
49 |
49 #include <stdio.h> // jpeglib needs this to be pre-included |
50 #include <stdio.h> // jpeglib needs this to be pre-included |
50 #include <setjmp.h> |
51 #include <setjmp.h> |
51 |
52 |
52 #ifdef FAR |
53 #ifdef FAR |
72 # undef const // remove crazy C hackery in jconfig.h |
73 # undef const // remove crazy C hackery in jconfig.h |
73 #endif |
74 #endif |
74 } |
75 } |
75 |
76 |
76 QT_BEGIN_NAMESPACE |
77 QT_BEGIN_NAMESPACE |
|
78 |
|
79 void QT_FASTCALL convert_rgb888_to_rgb32_C(quint32 *dst, const uchar *src, int len) |
|
80 { |
|
81 // Expand 24->32 bpp. |
|
82 for (int i = 0; i < len; ++i) { |
|
83 *dst++ = qRgb(src[0], src[1], src[2]); |
|
84 src += 3; |
|
85 } |
|
86 } |
|
87 |
|
88 typedef void (QT_FASTCALL *Rgb888ToRgb32Converter)(quint32 *dst, const uchar *src, int len); |
|
89 |
|
90 static Rgb888ToRgb32Converter rgb888ToRgb32ConverterPtr = convert_rgb888_to_rgb32_C; |
77 |
91 |
78 struct my_error_mgr : public jpeg_error_mgr { |
92 struct my_error_mgr : public jpeg_error_mgr { |
79 jmp_buf setjmp_buffer; |
93 jmp_buf setjmp_buffer; |
80 }; |
94 }; |
81 |
95 |
391 |
405 |
392 if (y < 0) |
406 if (y < 0) |
393 continue; // Haven't reached the starting line yet. |
407 continue; // Haven't reached the starting line yet. |
394 |
408 |
395 if (info->output_components == 3) { |
409 if (info->output_components == 3) { |
396 // Expand 24->32 bpp. |
|
397 uchar *in = rows[0] + clip.x() * 3; |
410 uchar *in = rows[0] + clip.x() * 3; |
398 QRgb *out = (QRgb*)outImage->scanLine(y); |
411 QRgb *out = (QRgb*)outImage->scanLine(y); |
399 for (int i = 0; i < clip.width(); ++i) { |
412 rgb888ToRgb32ConverterPtr(out, in, clip.width()); |
400 *out++ = qRgb(in[0], in[1], in[2]); |
|
401 in += 3; |
|
402 } |
|
403 } else if (info->out_color_space == JCS_CMYK) { |
413 } else if (info->out_color_space == JCS_CMYK) { |
404 // Convert CMYK->RGB. |
414 // Convert CMYK->RGB. |
405 uchar *in = rows[0] + clip.x() * 4; |
415 uchar *in = rows[0] + clip.x() * 4; |
406 QRgb *out = (QRgb*)outImage->scanLine(y); |
416 QRgb *out = (QRgb*)outImage->scanLine(y); |
407 for (int i = 0; i < clip.width(); ++i) { |
417 for (int i = 0; i < clip.width(); ++i) { |
791 } |
801 } |
792 |
802 |
793 QJpegHandler::QJpegHandler() |
803 QJpegHandler::QJpegHandler() |
794 : d(new QJpegHandlerPrivate(this)) |
804 : d(new QJpegHandlerPrivate(this)) |
795 { |
805 { |
|
806 const uint features = qDetectCPUFeatures(); |
|
807 Q_UNUSED(features); |
|
808 #if defined(QT_HAVE_NEON) |
|
809 // from qimage_neon.cpp |
|
810 Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_neon(quint32 *dst, const uchar *src, int len); |
|
811 |
|
812 if (features & NEON) |
|
813 rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_neon; |
|
814 #endif // QT_HAVE_NEON |
|
815 #if defined(QT_HAVE_SSSE3) |
|
816 // from qimage_ssse3.cpp |
|
817 Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len); |
|
818 |
|
819 if (features & SSSE3) |
|
820 rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_ssse3; |
|
821 #endif // QT_HAVE_SSSE3 |
796 } |
822 } |
797 |
823 |
798 QJpegHandler::~QJpegHandler() |
824 QJpegHandler::~QJpegHandler() |
799 { |
825 { |
800 delete d; |
826 delete d; |