OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
3 * | 3 * |
4 * Portions are Copyright (C) 2001-6 mozilla.org | 4 * Portions are Copyright (C) 2001-6 mozilla.org |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Stuart Parmenter <stuart@mozilla.com> | 7 * Stuart Parmenter <stuart@mozilla.com> |
8 * | 8 * |
9 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 9 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
10 * | 10 * |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 { | 256 { |
257 int h = info->cur_comp_info[0]->h_samp_factor; | 257 int h = info->cur_comp_info[0]->h_samp_factor; |
258 int v = info->cur_comp_info[0]->v_samp_factor; | 258 int v = info->cur_comp_info[0]->v_samp_factor; |
259 return IntSize((info->output_width + h - 1) / h, (info->output_height + v -
1) / v); | 259 return IntSize((info->output_width + h - 1) / h, (info->output_height + v -
1) / v); |
260 } | 260 } |
261 | 261 |
262 static yuv_subsampling yuvSubsampling(const jpeg_decompress_struct& info) | 262 static yuv_subsampling yuvSubsampling(const jpeg_decompress_struct& info) |
263 { | 263 { |
264 if ((DCTSIZE == 8) | 264 if ((DCTSIZE == 8) |
265 && (info.num_components == 3) | 265 && (info.num_components == 3) |
| 266 && (info.comps_in_scan >= info.num_components) |
266 && (info.scale_denom <= 8) | 267 && (info.scale_denom <= 8) |
| 268 && (info.cur_comp_info[0]) |
| 269 && (info.cur_comp_info[1]) |
| 270 && (info.cur_comp_info[2]) |
267 && (info.cur_comp_info[1]->h_samp_factor == 1) | 271 && (info.cur_comp_info[1]->h_samp_factor == 1) |
268 && (info.cur_comp_info[1]->v_samp_factor == 1) | 272 && (info.cur_comp_info[1]->v_samp_factor == 1) |
269 && (info.cur_comp_info[2]->h_samp_factor == 1) | 273 && (info.cur_comp_info[2]->h_samp_factor == 1) |
270 && (info.cur_comp_info[2]->v_samp_factor == 1)) { | 274 && (info.cur_comp_info[2]->v_samp_factor == 1)) { |
271 int h = info.cur_comp_info[0]->h_samp_factor; | 275 int h = info.cur_comp_info[0]->h_samp_factor; |
272 int v = info.cur_comp_info[0]->v_samp_factor; | 276 int v = info.cur_comp_info[0]->v_samp_factor; |
273 // 4:4:4 : (h == 1) && (v == 1) | 277 // 4:4:4 : (h == 1) && (v == 1) |
274 // 4:4:0 : (h == 1) && (v == 2) | 278 // 4:4:0 : (h == 1) && (v == 2) |
275 // 4:2:2 : (h == 2) && (v == 1) | 279 // 4:2:2 : (h == 2) && (v == 1) |
276 // 4:2:0 : (h == 2) && (v == 2) | 280 // 4:2:0 : (h == 2) && (v == 2) |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 // has failed. | 1001 // has failed. |
998 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) | 1002 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) |
999 setFailed(); | 1003 setFailed(); |
1000 // If we're done decoding the image, we don't need the JPEGImageReader | 1004 // If we're done decoding the image, we don't need the JPEGImageReader |
1001 // anymore. (If we failed, |m_reader| has already been cleared.) | 1005 // anymore. (If we failed, |m_reader| has already been cleared.) |
1002 else if ((!m_frameBufferCache.isEmpty() && (m_frameBufferCache[0].status() =
= ImageFrame::FrameComplete)) || (hasImagePlanes() && !onlySize)) | 1006 else if ((!m_frameBufferCache.isEmpty() && (m_frameBufferCache[0].status() =
= ImageFrame::FrameComplete)) || (hasImagePlanes() && !onlySize)) |
1003 m_reader.clear(); | 1007 m_reader.clear(); |
1004 } | 1008 } |
1005 | 1009 |
1006 } | 1010 } |
OLD | NEW |