annotate libmpcodecs/vd_ijpg.c @ 18746:497ebe3ecc2b

Software Scaler headers usage cleanup
author lucabe
date Sun, 18 Jun 2006 10:59:23 +0000
parents 0b6b5f2f8c9a
children 1767c271d710
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
1
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
2 #include <stdio.h>
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
3 #include <stdlib.h>
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
4
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
5 #include "config.h"
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
6 #include "mp_msg.h"
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
7
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
8 #include <jpeglib.h>
5048
2f53b53385e2 libjpeg and loader conflict workaround
pontscho
parents: 5042
diff changeset
9 #define UINT16 IJPG_UINT16
2f53b53385e2 libjpeg and loader conflict workaround
pontscho
parents: 5042
diff changeset
10 #define INT16 IJPG_INT16
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
11
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
12 #include <setjmp.h>
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
13
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
14 #include "bswap.h"
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
15 #include "libvo/fastmemcpy.h"
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
16
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
17 #include "vd_internal.h"
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
18
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
19 static vd_info_t info = {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
20 "JPEG Images decoder",
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
21 "ijpg",
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
22 "Pontscho",
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
23 "based on vd_mpng.c",
18604
0b6b5f2f8c9a Spelling fix
pacman
parents: 18167
diff changeset
24 "uses Independent JPEG Group's jpeglib"
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
25 };
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
26
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
27 LIBVD_EXTERN(ijpg)
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
28
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
29 static int last_w=-1;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
30 static int last_h=-1;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
31
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
32 // to set/get/query special features/parameters
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
33 static int control(sh_video_t *sh,int cmd,void* arg,...){
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
34 return CONTROL_UNKNOWN;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
35 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
36
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
37 // init driver
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
38 static int init(sh_video_t *sh){
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
39 last_w=-1;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
40 return 1;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
41 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
42
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
43 // uninit driver
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
44 static void uninit(sh_video_t *sh){
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
45 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
46
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
47 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
48
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
49 typedef struct
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
50 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
51 struct jpeg_source_mgr pub;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
52 unsigned char * inbuf;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
53 int bufsize;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
54 } my_source_mgr;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
55
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
56 typedef my_source_mgr * my_src_ptr;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
57
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
58 METHODDEF(void) init_source (j_decompress_ptr cinfo)
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
59 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
60 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
61
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
62 METHODDEF(boolean) fill_input_buffer (j_decompress_ptr cinfo)
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
63 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
64 my_src_ptr src = (my_src_ptr) cinfo->src;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
65 src->pub.next_input_byte = src->inbuf;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
66 src->pub.bytes_in_buffer = src->bufsize;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
67 return TRUE;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
68 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
69
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
70 METHODDEF(void) skip_input_data (j_decompress_ptr cinfo, long num_bytes)
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
71 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
72 my_src_ptr src = (my_src_ptr) cinfo->src;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
73
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
74 if (num_bytes > 0)
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
75 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
76 while (num_bytes > (long) src->pub.bytes_in_buffer)
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
77 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
78 num_bytes -= (long) src->pub.bytes_in_buffer;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
79 (void) fill_input_buffer(cinfo);
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
80 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
81 src->pub.next_input_byte += (size_t) num_bytes;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
82 src->pub.bytes_in_buffer -= (size_t) num_bytes;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
83 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
84 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
85
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
86 METHODDEF(void) term_source (j_decompress_ptr cinfo) { }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
87
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
88 GLOBAL(void) jpeg_buf_src ( j_decompress_ptr cinfo, char * inbuf,int bufsize )
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
89 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
90 my_src_ptr src;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
91 if (cinfo->src == NULL) cinfo->src=malloc( sizeof( my_source_mgr ) );
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
92 src = (my_src_ptr) cinfo->src;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
93 src->pub.init_source = init_source;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
94 src->pub.fill_input_buffer = fill_input_buffer;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
95 src->pub.skip_input_data = skip_input_data;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
96 src->pub.resync_to_restart = jpeg_resync_to_restart;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
97 src->pub.term_source = term_source;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
98 src->inbuf = inbuf;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
99 src->bufsize=bufsize;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
100 src->pub.bytes_in_buffer = 0;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
101 src->pub.next_input_byte = NULL;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
102 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
103
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
104 struct my_error_mgr
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
105 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
106 struct jpeg_error_mgr pub;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
107 jmp_buf setjmp_buffer;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
108 };
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
109
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
110 typedef struct my_error_mgr * my_error_ptr;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
111
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
112 METHODDEF(void) my_error_exit (j_common_ptr cinfo)
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
113 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
114 my_error_ptr myerr=(my_error_ptr) cinfo->err;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
115 (*cinfo->err->output_message) (cinfo);
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
116 longjmp(myerr->setjmp_buffer, 1);
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
117 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
118
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
119 static struct jpeg_decompress_struct cinfo;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
120 static struct my_error_mgr jerr;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
121 static int row_stride;
6097
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
122 static unsigned char *temp_row=NULL;
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
123
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
124 // decode a frame
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
125 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
126 mp_image_t * mpi = NULL;
6097
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
127 int width,height,depth,i;
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
128
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
129 if ( len <= 0 ) return NULL; // skipped frame
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
130
5366
f46873b05f82 eeh 10l removed too much lines :(
atmos4
parents: 5365
diff changeset
131 cinfo.err=jpeg_std_error( &jerr.pub );
f46873b05f82 eeh 10l removed too much lines :(
atmos4
parents: 5365
diff changeset
132 jerr.pub.error_exit=my_error_exit;
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
133 if( setjmp( jerr.setjmp_buffer ) )
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
134 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
135 mp_msg( MSGT_DECVIDEO,MSGL_ERR,"[ijpg] setjmp error ...\n" );
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
136 return NULL;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
137 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
138
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
139 jpeg_create_decompress( &cinfo );
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
140 jpeg_buf_src( &cinfo,data,len );
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
141 jpeg_read_header( &cinfo,TRUE );
5365
b87743434e1f Issue a warning in VDec if disp_w and disp_h weren't set by codec and try workaround.
atmos4
parents: 5124
diff changeset
142 sh->disp_w=width=cinfo.image_width;
b87743434e1f Issue a warning in VDec if disp_w and disp_h weren't set by codec and try workaround.
atmos4
parents: 5124
diff changeset
143 sh->disp_h=height=cinfo.image_height;
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
144 jpeg_start_decompress( &cinfo );
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
145 depth=cinfo.output_components * 8;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
146
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
147 switch( depth ) {
6097
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
148 case 8:
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
149 case 24: break;
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
150 default: mp_msg( MSGT_DECVIDEO,MSGL_ERR,"Sorry, unsupported JPEG colorspace: %d.\n",depth ); return NULL;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
151 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
152
6097
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
153 if ( last_w!=width || last_h!=height )
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
154 {
6097
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
155 if(!mpcodecs_config_vo( sh,width,height, IMGFMT_RGB24 )) return NULL;
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
156 if(temp_row) free(temp_row);
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
157 temp_row=malloc(3*width+16);
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
158 last_w=width; last_h=height;
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
159 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
160
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
161 mpi=mpcodecs_get_image( sh,MP_IMGTYPE_TEMP,MP_IMGFLAG_ACCEPT_STRIDE,width,height );
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
162 if ( !mpi ) return NULL;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
163
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
164 row_stride=cinfo.output_width * cinfo.output_components;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
165
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
166 for ( i=0;i < height;i++ )
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
167 {
6097
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
168 unsigned char * drow = mpi->planes[0] + mpi->stride[0] * i;
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
169 unsigned char * row = (mpi->imgfmt==IMGFMT_RGB24 && depth==24) ? drow : temp_row;
5042
75e4f695f204 kill few warning
pontscho
parents: 5033
diff changeset
170 jpeg_read_scanlines( &cinfo,(JSAMPLE**)&row,1 );
6097
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
171 if(depth==8){
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
172 // grayscale -> rgb/bgr 24/32
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
173 int x;
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
174 if(mpi->bpp==32)
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
175 for(x=0;x<width;x++) drow[4*x]=0x010101*row[x];
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
176 else
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
177 for(x=0;x<width;x++) drow[3*x+0]=drow[3*x+1]=drow[3*x+2]=row[x];
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
178 } else {
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
179 int x;
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
180 switch(mpi->imgfmt){
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
181 // rgb24 -> bgr24
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
182 case IMGFMT_BGR24:
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
183 for(x=0;x<3*width;x+=3){
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
184 drow[x+0]=row[x+2];
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
185 drow[x+1]=row[x+1];
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
186 drow[x+2]=row[x+0];
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
187 }
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
188 break;
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
189 // rgb24 -> bgr32
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
190 case IMGFMT_BGR32:
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
191 for(x=0;x<width;x++){
18167
f167814411d4 Fix BGR32 big-endian output
pacman
parents: 7472
diff changeset
192 #ifdef WORDS_BIGENDIAN
f167814411d4 Fix BGR32 big-endian output
pacman
parents: 7472
diff changeset
193 drow[4*x+1]=row[3*x+0];
f167814411d4 Fix BGR32 big-endian output
pacman
parents: 7472
diff changeset
194 drow[4*x+2]=row[3*x+1];
f167814411d4 Fix BGR32 big-endian output
pacman
parents: 7472
diff changeset
195 drow[4*x+3]=row[3*x+2];
f167814411d4 Fix BGR32 big-endian output
pacman
parents: 7472
diff changeset
196 #else
6097
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
197 drow[4*x+0]=row[3*x+2];
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
198 drow[4*x+1]=row[3*x+1];
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
199 drow[4*x+2]=row[3*x+0];
18167
f167814411d4 Fix BGR32 big-endian output
pacman
parents: 7472
diff changeset
200 #endif
6097
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
201 }
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
202 break;
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
203 }
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
204 }
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
205 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
206
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
207 jpeg_finish_decompress(&cinfo);
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
208 jpeg_destroy_decompress(&cinfo);
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
209
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
210 return mpi;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
211 }