annotate libmpcodecs/vd_ijpg.c @ 31915:c1e009d855b5

Avoid another unnecessary intermediate variable.
author reimar
date Sat, 21 Aug 2010 09:58:02 +0000
parents 78180f8459a9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30421
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
1 /*
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
2 * This file is part of MPlayer.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
3 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
5 * it under the terms of the GNU General Public License as published by
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
7 * (at your option) any later version.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
8 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
12 * GNU General Public License for more details.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
13 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
14 * You should have received a copy of the GNU General Public License along
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26280
diff changeset
17 */
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
18
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
19 #include <stdio.h>
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
20 #include <stdlib.h>
23305
22d3d12c6dfb Include string.h for memcpy, fastmemcpy.h alone is not enough.
reimar
parents: 21507
diff changeset
21 #include <string.h>
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
22
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
23 #include "config.h"
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
24 #include "mp_msg.h"
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
25
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
26 #include <jpeglib.h>
5048
2f53b53385e2 libjpeg and loader conflict workaround
pontscho
parents: 5042
diff changeset
27 #define UINT16 IJPG_UINT16
2f53b53385e2 libjpeg and loader conflict workaround
pontscho
parents: 5042
diff changeset
28 #define INT16 IJPG_INT16
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
29
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
30 #include <setjmp.h>
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
31
21507
fa99b3d31d13 Hack around libavutil/bswap.h compilation problems due to always_inline undefined.
reimar
parents: 21372
diff changeset
32 #include "mpbswap.h"
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
33
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
34 #include "vd_internal.h"
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
35
30504
cc27da5d7286 Mark all ad_info_t/vd_info_t structure declarations as const.
diego
parents: 30421
diff changeset
36 static const vd_info_t info = {
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
37 "JPEG Images decoder",
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
38 "ijpg",
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
39 "Pontscho",
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
40 "based on vd_mpng.c",
18604
0b6b5f2f8c9a Spelling fix
pacman
parents: 18167
diff changeset
41 "uses Independent JPEG Group's jpeglib"
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
42 };
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
43
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
44 LIBVD_EXTERN(ijpg)
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
45
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
46 static int last_w=-1;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
47 static int last_h=-1;
25667
a9fd64f3d166 Colourspace conversions do _not_ belong into a decoder!
reimar
parents: 25666
diff changeset
48 static int last_depth=-1;
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
49
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
50 // to set/get/query special features/parameters
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
51 static int control(sh_video_t *sh,int cmd,void* arg,...){
25667
a9fd64f3d166 Colourspace conversions do _not_ belong into a decoder!
reimar
parents: 25666
diff changeset
52 if (cmd == VDCTRL_QUERY_FORMAT) {
a9fd64f3d166 Colourspace conversions do _not_ belong into a decoder!
reimar
parents: 25666
diff changeset
53 int format = *(int *)arg;
a9fd64f3d166 Colourspace conversions do _not_ belong into a decoder!
reimar
parents: 25666
diff changeset
54 if ((last_depth == 24 && format == IMGFMT_RGB24) ||
a9fd64f3d166 Colourspace conversions do _not_ belong into a decoder!
reimar
parents: 25666
diff changeset
55 (last_depth == 8 && format == IMGFMT_Y8 ))
a9fd64f3d166 Colourspace conversions do _not_ belong into a decoder!
reimar
parents: 25666
diff changeset
56 return CONTROL_TRUE;
a9fd64f3d166 Colourspace conversions do _not_ belong into a decoder!
reimar
parents: 25666
diff changeset
57 return CONTROL_FALSE;
a9fd64f3d166 Colourspace conversions do _not_ belong into a decoder!
reimar
parents: 25666
diff changeset
58 }
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
59 return CONTROL_UNKNOWN;
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 // init driver
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
63 static int init(sh_video_t *sh){
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
64 last_w=-1;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
65 return 1;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
66 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
67
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
68 // uninit driver
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
69 static void uninit(sh_video_t *sh){
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
70 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
71
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
72 //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
73
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
74 typedef struct
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
75 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
76 struct jpeg_source_mgr pub;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
77 unsigned char * inbuf;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
78 int bufsize;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
79 } my_source_mgr;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
80
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
81 typedef my_source_mgr * my_src_ptr;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
82
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
83 METHODDEF(void) init_source (j_decompress_ptr cinfo)
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
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
87 METHODDEF(boolean) fill_input_buffer (j_decompress_ptr cinfo)
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
88 {
25666
79fee31fb216 Cosmetics: get rid of huge amounts of trailing whitespace
reimar
parents: 25665
diff changeset
89 my_src_ptr src = (my_src_ptr) cinfo->src;
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
90 src->pub.next_input_byte = src->inbuf;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
91 src->pub.bytes_in_buffer = src->bufsize;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
92 return TRUE;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
93 }
25666
79fee31fb216 Cosmetics: get rid of huge amounts of trailing whitespace
reimar
parents: 25665
diff changeset
94
79fee31fb216 Cosmetics: get rid of huge amounts of trailing whitespace
reimar
parents: 25665
diff changeset
95 METHODDEF(void) skip_input_data (j_decompress_ptr cinfo, long num_bytes)
79fee31fb216 Cosmetics: get rid of huge amounts of trailing whitespace
reimar
parents: 25665
diff changeset
96 {
79fee31fb216 Cosmetics: get rid of huge amounts of trailing whitespace
reimar
parents: 25665
diff changeset
97 my_src_ptr src = (my_src_ptr) cinfo->src;
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
98
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
99 if (num_bytes > 0)
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
100 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
101 while (num_bytes > (long) src->pub.bytes_in_buffer)
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
102 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
103 num_bytes -= (long) src->pub.bytes_in_buffer;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
104 (void) fill_input_buffer(cinfo);
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
105 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
106 src->pub.next_input_byte += (size_t) num_bytes;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
107 src->pub.bytes_in_buffer -= (size_t) num_bytes;
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
25666
79fee31fb216 Cosmetics: get rid of huge amounts of trailing whitespace
reimar
parents: 25665
diff changeset
111 METHODDEF(void) term_source (j_decompress_ptr cinfo) { }
79fee31fb216 Cosmetics: get rid of huge amounts of trailing whitespace
reimar
parents: 25665
diff changeset
112
31197
78180f8459a9 Directly mark jpeg_buf_src() as void instead of using some indirection marcro.
diego
parents: 30555
diff changeset
113 static void jpeg_buf_src (j_decompress_ptr cinfo, char * inbuf, int bufsize)
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
114 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
115 my_src_ptr src;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
116 if (cinfo->src == NULL) cinfo->src=malloc( sizeof( my_source_mgr ) );
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
117 src = (my_src_ptr) cinfo->src;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
118 src->pub.init_source = init_source;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
119 src->pub.fill_input_buffer = fill_input_buffer;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
120 src->pub.skip_input_data = skip_input_data;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
121 src->pub.resync_to_restart = jpeg_resync_to_restart;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
122 src->pub.term_source = term_source;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
123 src->inbuf = inbuf;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
124 src->bufsize=bufsize;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
125 src->pub.bytes_in_buffer = 0;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
126 src->pub.next_input_byte = NULL;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
127 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
128
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
129 struct my_error_mgr
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
130 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
131 struct jpeg_error_mgr pub;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
132 jmp_buf setjmp_buffer;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
133 };
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
134
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
135 typedef struct my_error_mgr * my_error_ptr;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
136
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
137 METHODDEF(void) my_error_exit (j_common_ptr cinfo)
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
138 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
139 my_error_ptr myerr=(my_error_ptr) cinfo->err;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
140 (*cinfo->err->output_message) (cinfo);
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
141 longjmp(myerr->setjmp_buffer, 1);
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
142 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
143
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
144 // decode a frame
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
145 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
25664
a9e6d0744fc4 Avoid uselessly global variables
reimar
parents: 23375
diff changeset
146 struct jpeg_decompress_struct cinfo;
a9e6d0744fc4 Avoid uselessly global variables
reimar
parents: 23375
diff changeset
147 struct my_error_mgr jerr;
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
148 mp_image_t * mpi = NULL;
6097
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
149 int width,height,depth,i;
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
150
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
151 if ( len <= 0 ) return NULL; // skipped frame
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
152
25664
a9e6d0744fc4 Avoid uselessly global variables
reimar
parents: 23375
diff changeset
153 memset(&cinfo, 0, sizeof(cinfo));
a9e6d0744fc4 Avoid uselessly global variables
reimar
parents: 23375
diff changeset
154 memset(&jerr, 0, sizeof(jerr));
5366
f46873b05f82 eeh 10l removed too much lines :(
atmos4
parents: 5365
diff changeset
155 cinfo.err=jpeg_std_error( &jerr.pub );
f46873b05f82 eeh 10l removed too much lines :(
atmos4
parents: 5365
diff changeset
156 jerr.pub.error_exit=my_error_exit;
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
157 if( setjmp( jerr.setjmp_buffer ) )
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
158 {
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
159 mp_msg( MSGT_DECVIDEO,MSGL_ERR,"[ijpg] setjmp error ...\n" );
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
160 return NULL;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
161 }
25666
79fee31fb216 Cosmetics: get rid of huge amounts of trailing whitespace
reimar
parents: 25665
diff changeset
162
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
163 jpeg_create_decompress( &cinfo );
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
164 jpeg_buf_src( &cinfo,data,len );
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
165 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
166 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
167 sh->disp_h=height=cinfo.image_height;
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
168 jpeg_start_decompress( &cinfo );
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
169 depth=cinfo.output_components * 8;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
170
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
171 switch( depth ) {
6097
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
172 case 8:
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
173 case 24: break;
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
174 default: mp_msg( MSGT_DECVIDEO,MSGL_ERR,"Sorry, unsupported JPEG colorspace: %d.\n",depth ); return NULL;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
175 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
176
25667
a9fd64f3d166 Colourspace conversions do _not_ belong into a decoder!
reimar
parents: 25666
diff changeset
177 if ( last_w!=width || last_h!=height || last_depth != depth )
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
178 {
25667
a9fd64f3d166 Colourspace conversions do _not_ belong into a decoder!
reimar
parents: 25666
diff changeset
179 last_depth = depth;
a9fd64f3d166 Colourspace conversions do _not_ belong into a decoder!
reimar
parents: 25666
diff changeset
180 if(!mpcodecs_config_vo( sh,width,height, depth == 8 ? IMGFMT_Y8 : IMGFMT_RGB24 )) return NULL;
6097
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
181 last_w=width; last_h=height;
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
182 }
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
183
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
184 mpi=mpcodecs_get_image( sh,MP_IMGTYPE_TEMP,MP_IMGFLAG_ACCEPT_STRIDE,width,height );
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
185 if ( !mpi ) return NULL;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
186
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
187 for ( i=0;i < height;i++ )
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
188 {
6097
3e4936b52df4 rgb24, bgr 24/32 support even for grayscale
arpi
parents: 5366
diff changeset
189 unsigned char * drow = mpi->planes[0] + mpi->stride[0] * i;
25667
a9fd64f3d166 Colourspace conversions do _not_ belong into a decoder!
reimar
parents: 25666
diff changeset
190 jpeg_read_scanlines( &cinfo,(JSAMPLE**)&drow,1 );
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
191 }
25666
79fee31fb216 Cosmetics: get rid of huge amounts of trailing whitespace
reimar
parents: 25665
diff changeset
192
79fee31fb216 Cosmetics: get rid of huge amounts of trailing whitespace
reimar
parents: 25665
diff changeset
193 jpeg_finish_decompress(&cinfo);
79fee31fb216 Cosmetics: get rid of huge amounts of trailing whitespace
reimar
parents: 25665
diff changeset
194 jpeg_destroy_decompress(&cinfo);
79fee31fb216 Cosmetics: get rid of huge amounts of trailing whitespace
reimar
parents: 25665
diff changeset
195
5029
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
196 return mpi;
ef8a43b74075 Add IJPG decoder.
pontscho
parents:
diff changeset
197 }