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

Side by Side Diff: third_party/libopenjpeg20/invert.c

Issue 1416783002: Merge to M46: upgrade openjpeg to commit# cf352af (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@2490
Patch Set: Fix pdfium:168 since we are already half way there Created 5 years, 2 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/libopenjpeg20/indexbox_manager.h ('k') | third_party/libopenjpeg20/j2k.h » ('j') | 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 * The copyright in this software is being made available under the 2-clauses 2 * The copyright in this software is being made available under the 2-clauses
3 * BSD License, included below. This software may be subject to other third 3 * BSD License, included below. This software may be subject to other third
4 * party and contributor rights, including patent rights, and no such rights 4 * party and contributor rights, including patent rights, and no such rights
5 * are granted under this license. 5 * are granted under this license.
6 * 6 *
7 * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s .fr> 7 * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s .fr>
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 return OPJ_TRUE; 97 return OPJ_TRUE;
98 } 98 }
99 99
100 100
101 /* 101 /*
102 ========================================================== 102 ==========================================================
103 Local functions 103 Local functions
104 ========================================================== 104 ==========================================================
105 */ 105 */
106 OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,OPJ_UINT32 * permutations, 106 static OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,OPJ_UINT32 * permutations,
107 OPJ_FLOAT32 * p_swap_area, 107 OPJ_FLOAT32 * p_swap_area,
108 OPJ_UINT32 nb_compo) 108 OPJ_UINT32 nb_compo)
109 { 109 {
110 OPJ_UINT32 * tmpPermutations = permutations; 110 OPJ_UINT32 * tmpPermutations = permutations;
111 OPJ_UINT32 * dstPermutations; 111 OPJ_UINT32 * dstPermutations;
112 OPJ_UINT32 k2=0,t; 112 OPJ_UINT32 k2=0,t;
113 OPJ_FLOAT32 temp; 113 OPJ_FLOAT32 temp;
114 OPJ_UINT32 i,j,k; 114 OPJ_UINT32 i,j,k;
115 OPJ_FLOAT32 p; 115 OPJ_FLOAT32 p;
116 OPJ_UINT32 lLastColum = nb_compo - 1; 116 OPJ_UINT32 lLastColum = nb_compo - 1;
117 OPJ_UINT32 lSwapSize = nb_compo * (OPJ_UINT32)sizeof(OPJ_FLOAT32); 117 OPJ_UINT32 lSwapSize = nb_compo * (OPJ_UINT32)sizeof(OPJ_FLOAT32);
118 OPJ_FLOAT32 * lTmpMatrix = matrix; 118 OPJ_FLOAT32 * lTmpMatrix = matrix;
119 OPJ_FLOAT32 * lColumnMatrix,* lDestMatrix; 119 OPJ_FLOAT32 * lColumnMatrix,* lDestMatrix;
120 OPJ_UINT32 offset = 1; 120 OPJ_UINT32 offset = 1;
121 OPJ_UINT32 lStride = nb_compo-1; 121 OPJ_UINT32 lStride = nb_compo-1;
122 122
123 /*initialize permutations */ 123 /*initialize permutations */
124 for (i = 0; i < nb_compo; ++i) 124 for (i = 0; i < nb_compo; ++i)
125 { 125 {
126 *tmpPermutations++ = i; 126 *tmpPermutations++ = i;
127 } 127 }
128 » /* now make a pivot with colum switch */ 128 » /* now make a pivot with column switch */
129 tmpPermutations = permutations; 129 tmpPermutations = permutations;
130 for (k = 0; k < lLastColum; ++k) { 130 for (k = 0; k < lLastColum; ++k) {
131 p = 0.0; 131 p = 0.0;
132 132
133 /* take the middle element */ 133 /* take the middle element */
134 lColumnMatrix = lTmpMatrix + k; 134 lColumnMatrix = lTmpMatrix + k;
135 135
136 /* make permutation with the biggest value in the column */ 136 /* make permutation with the biggest value in the column */
137 for (i = k; i < nb_compo; ++i) { 137 for (i = k; i < nb_compo; ++i) {
138 temp = ((*lColumnMatrix > 0) ? *lColumnMatrix : -(*lColu mnMatrix)); 138 temp = ((*lColumnMatrix > 0) ? *lColumnMatrix : -(*lColu mnMatrix));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 /* 1 element less for stride */ 197 /* 1 element less for stride */
198 --lStride; 198 --lStride;
199 /* next line */ 199 /* next line */
200 lTmpMatrix+=nb_compo; 200 lTmpMatrix+=nb_compo;
201 /* next permutation element */ 201 /* next permutation element */
202 ++tmpPermutations; 202 ++tmpPermutations;
203 } 203 }
204 return OPJ_TRUE; 204 return OPJ_TRUE;
205 } 205 }
206 206
207 void opj_lupSolve (OPJ_FLOAT32 * pResult, 207 static void opj_lupSolve (OPJ_FLOAT32 * pResult,
208 OPJ_FLOAT32 * pMatrix, 208 OPJ_FLOAT32 * pMatrix,
209 OPJ_FLOAT32 * pVector, 209 OPJ_FLOAT32 * pVector,
210 OPJ_UINT32* pPermutations, 210 OPJ_UINT32* pPermutations,
211 OPJ_UINT32 nb_compo,OPJ_FLOAT32 * p_intermediate_data) 211 OPJ_UINT32 nb_compo,OPJ_FLOAT32 * p_intermediate_data)
212 { 212 {
213 OPJ_INT32 k; 213 OPJ_INT32 k;
214 OPJ_UINT32 i,j; 214 OPJ_UINT32 i,j;
215 OPJ_FLOAT32 sum; 215 OPJ_FLOAT32 sum;
216 OPJ_FLOAT32 u; 216 OPJ_FLOAT32 u;
217 OPJ_UINT32 lStride = nb_compo+1; 217 OPJ_UINT32 lStride = nb_compo+1;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 /* sum += matrix[k][j] * x[j] */ 259 /* sum += matrix[k][j] * x[j] */
260 sum += (*(lTmpMatrix++)) * (*(lCurrentPtr++)); 260 sum += (*(lTmpMatrix++)) * (*(lCurrentPtr++));
261 } 261 }
262 /*x[k] = (y[k] - sum) / u; */ 262 /*x[k] = (y[k] - sum) / u; */
263 *(lBeginPtr--) = (*(lGeneratedData--) - sum) / u; 263 *(lBeginPtr--) = (*(lGeneratedData--) - sum) / u;
264 lLineMatrix -= lStride; 264 lLineMatrix -= lStride;
265 } 265 }
266 } 266 }
267 267
268 268
269 void opj_lupInvert (OPJ_FLOAT32 * pSrcMatrix, 269 static void opj_lupInvert (OPJ_FLOAT32 * pSrcMatrix,
270 OPJ_FLOAT32 * pDestMatrix, 270 OPJ_FLOAT32 * pDestMatrix,
271 OPJ_UINT32 nb_compo, 271 OPJ_UINT32 nb_compo,
272 OPJ_UINT32 * pPermutations, 272 OPJ_UINT32 * pPermutations,
273 OPJ_FLOAT32 * p_src_temp, 273 OPJ_FLOAT32 * p_src_temp,
274 OPJ_FLOAT32 * p_dest_temp, 274 OPJ_FLOAT32 * p_dest_temp,
275 OPJ_FLOAT32 * p_swap_area ) 275 OPJ_FLOAT32 * p_swap_area )
276 { 276 {
277 OPJ_UINT32 j,i; 277 OPJ_UINT32 j,i;
278 OPJ_FLOAT32 * lCurrentPtr; 278 OPJ_FLOAT32 * lCurrentPtr;
279 OPJ_FLOAT32 * lLineMatrix = pDestMatrix; 279 OPJ_FLOAT32 * lLineMatrix = pDestMatrix;
280 OPJ_UINT32 lSwapSize = nb_compo * (OPJ_UINT32)sizeof(OPJ_FLOAT32); 280 OPJ_UINT32 lSwapSize = nb_compo * (OPJ_UINT32)sizeof(OPJ_FLOAT32);
281 281
282 for (j = 0; j < nb_compo; ++j) { 282 for (j = 0; j < nb_compo; ++j) {
283 lCurrentPtr = lLineMatrix++; 283 lCurrentPtr = lLineMatrix++;
284 memset(p_src_temp,0,lSwapSize); 284 memset(p_src_temp,0,lSwapSize);
285 p_src_temp[j] = 1.0; 285 p_src_temp[j] = 1.0;
286 opj_lupSolve(p_dest_temp,pSrcMatrix,p_src_temp, pPermutations, n b_compo , p_swap_area); 286 opj_lupSolve(p_dest_temp,pSrcMatrix,p_src_temp, pPermutations, n b_compo , p_swap_area);
287 287
288 for (i = 0; i < nb_compo; ++i) { 288 for (i = 0; i < nb_compo; ++i) {
289 *(lCurrentPtr) = p_dest_temp[i]; 289 *(lCurrentPtr) = p_dest_temp[i];
290 lCurrentPtr+=nb_compo; 290 lCurrentPtr+=nb_compo;
291 } 291 }
292 } 292 }
293 } 293 }
294 294
OLDNEW
« no previous file with comments | « third_party/libopenjpeg20/indexbox_manager.h ('k') | third_party/libopenjpeg20/j2k.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698