Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp

Issue 1849393002: Enable yuv decoding of progressive jpegs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Needs rebaseline Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 static size_t computeYUVWidthBytes(const jpeg_decompress_struct* info, int compo nent) 213 static size_t computeYUVWidthBytes(const jpeg_decompress_struct* info, int compo nent)
214 { 214 {
215 return info->cur_comp_info[component]->width_in_blocks * DCTSIZE; 215 return info->cur_comp_info[component]->width_in_blocks * DCTSIZE;
216 } 216 }
217 217
218 static yuv_subsampling yuvSubsampling(const jpeg_decompress_struct& info) 218 static yuv_subsampling yuvSubsampling(const jpeg_decompress_struct& info)
219 { 219 {
220 if ((DCTSIZE == 8) 220 if ((DCTSIZE == 8)
221 && (info.num_components == 3) 221 && (info.num_components == 3)
222 && (info.comps_in_scan >= info.num_components)
223 && (info.scale_denom <= 8) 222 && (info.scale_denom <= 8)
224 && (info.cur_comp_info[0]) 223 && (info.cur_comp_info[0])
225 && (info.cur_comp_info[1]) 224 && (info.cur_comp_info[1])
226 && (info.cur_comp_info[2]) 225 && (info.cur_comp_info[2])
227 && (info.cur_comp_info[1]->h_samp_factor == 1) 226 && (info.cur_comp_info[1]->h_samp_factor == 1)
228 && (info.cur_comp_info[1]->v_samp_factor == 1) 227 && (info.cur_comp_info[1]->v_samp_factor == 1)
229 && (info.cur_comp_info[2]->h_samp_factor == 1) 228 && (info.cur_comp_info[2]->h_samp_factor == 1)
230 && (info.cur_comp_info[2]->v_samp_factor == 1)) { 229 && (info.cur_comp_info[2]->v_samp_factor == 1)) {
231 int h = info.cur_comp_info[0]->h_samp_factor; 230 int h = info.cur_comp_info[0]->h_samp_factor;
232 int v = info.cur_comp_info[0]->v_samp_factor; 231 int v = info.cur_comp_info[0]->v_samp_factor;
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 { 848 {
850 JSAMPARRAY samples = reader->samples(); 849 JSAMPARRAY samples = reader->samples();
851 jpeg_decompress_struct* info = reader->info(); 850 jpeg_decompress_struct* info = reader->info();
852 851
853 JSAMPARRAY bufferraw[3]; 852 JSAMPARRAY bufferraw[3];
854 JSAMPROW bufferraw2[32]; 853 JSAMPROW bufferraw2[32];
855 bufferraw[0] = &bufferraw2[0]; // Y channel rows (8 or 16) 854 bufferraw[0] = &bufferraw2[0]; // Y channel rows (8 or 16)
856 bufferraw[1] = &bufferraw2[16]; // U channel rows (8) 855 bufferraw[1] = &bufferraw2[16]; // U channel rows (8)
857 bufferraw[2] = &bufferraw2[24]; // V channel rows (8) 856 bufferraw[2] = &bufferraw2[24]; // V channel rows (8)
858 int yHeight = info->output_height; 857 int yHeight = info->output_height;
859 int v = info->cur_comp_info[0]->v_samp_factor; 858 int v = info->comp_info[0].v_samp_factor;
860 IntSize uvSize = reader->uvSize(); 859 IntSize uvSize = reader->uvSize();
861 int uvHeight = uvSize.height(); 860 int uvHeight = uvSize.height();
862 JSAMPROW outputY = static_cast<JSAMPROW>(imagePlanes->plane(0)); 861 JSAMPROW outputY = static_cast<JSAMPROW>(imagePlanes->plane(0));
863 JSAMPROW outputU = static_cast<JSAMPROW>(imagePlanes->plane(1)); 862 JSAMPROW outputU = static_cast<JSAMPROW>(imagePlanes->plane(1));
864 JSAMPROW outputV = static_cast<JSAMPROW>(imagePlanes->plane(2)); 863 JSAMPROW outputV = static_cast<JSAMPROW>(imagePlanes->plane(2));
865 size_t rowBytesY = imagePlanes->rowBytes(0); 864 size_t rowBytesY = imagePlanes->rowBytes(0);
866 size_t rowBytesU = imagePlanes->rowBytes(1); 865 size_t rowBytesU = imagePlanes->rowBytes(1);
867 size_t rowBytesV = imagePlanes->rowBytes(2); 866 size_t rowBytesV = imagePlanes->rowBytes(2);
868 867
869 // Request 8 or 16 scanlines: returns 0 or more scanlines. 868 // Request 8 or 16 scanlines: returns 0 or more scanlines.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 // has failed. 988 // has failed.
990 if (!m_reader->decode(onlySize) && isAllDataReceived()) 989 if (!m_reader->decode(onlySize) && isAllDataReceived())
991 setFailed(); 990 setFailed();
992 991
993 // If decoding is done or failed, we don't need the JPEGImageReader anymore. 992 // If decoding is done or failed, we don't need the JPEGImageReader anymore.
994 if (isComplete(this, onlySize) || failed()) 993 if (isComplete(this, onlySize) || failed())
995 m_reader.clear(); 994 m_reader.clear();
996 } 995 }
997 996
998 } // namespace blink 997 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698