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

Side by Side Diff: core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/t1.c

Issue 589243004: Update openjpeg (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Update to openjpeg r2891 Created 6 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
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) 2002-2014, Universite catholique de Louvain (UCL), Belgium 7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
8 * Copyright (c) 2002-2014, Professor Benoit Macq 8 * Copyright (c) 2002-2014, Professor Benoit Macq
9 * Copyright (c) 2001-2003, David Janssens 9 * Copyright (c) 2001-2003, David Janssens
10 * Copyright (c) 2002-2003, Yannick Verschueren 10 * Copyright (c) 2002-2003, Yannick Verschueren
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 OPJ_UINT32 w, 1163 OPJ_UINT32 w,
1164 OPJ_UINT32 h) 1164 OPJ_UINT32 h)
1165 { 1165 {
1166 OPJ_UINT32 datasize=w * h; 1166 OPJ_UINT32 datasize=w * h;
1167 OPJ_UINT32 flagssize; 1167 OPJ_UINT32 flagssize;
1168 1168
1169 if(datasize > t1->datasize){ 1169 if(datasize > t1->datasize){
1170 opj_aligned_free(t1->data); 1170 opj_aligned_free(t1->data);
1171 t1->data = (OPJ_INT32*) opj_aligned_malloc(datasize * sizeof(OPJ _INT32)); 1171 t1->data = (OPJ_INT32*) opj_aligned_malloc(datasize * sizeof(OPJ _INT32));
1172 if(!t1->data){ 1172 if(!t1->data){
1173 /* FIXME event manager error callback */
1173 return OPJ_FALSE; 1174 return OPJ_FALSE;
1174 } 1175 }
1175 t1->datasize=datasize; 1176 t1->datasize=datasize;
1176 } 1177 }
1177 memset(t1->data,0,datasize * sizeof(OPJ_INT32)); 1178 memset(t1->data,0,datasize * sizeof(OPJ_INT32));
1178 1179
1179 t1->flags_stride=w+2; 1180 t1->flags_stride=w+2;
1180 flagssize=t1->flags_stride * (h+2); 1181 flagssize=t1->flags_stride * (h+2);
1181 1182
1182 if(flagssize > t1->flagssize){ 1183 if(flagssize > t1->flagssize){
1183 opj_aligned_free(t1->flags); 1184 opj_aligned_free(t1->flags);
1184 t1->flags = (opj_flag_t*) opj_aligned_malloc(flagssize * sizeof( opj_flag_t)); 1185 t1->flags = (opj_flag_t*) opj_aligned_malloc(flagssize * sizeof( opj_flag_t));
1185 if(!t1->flags){ 1186 if(!t1->flags){
1187 /* FIXME event manager error callback */
1186 return OPJ_FALSE; 1188 return OPJ_FALSE;
1187 } 1189 }
1188 t1->flagssize=flagssize; 1190 t1->flagssize=flagssize;
1189 } 1191 }
1190 memset(t1->flags,0,flagssize * sizeof(opj_flag_t)); 1192 memset(t1->flags,0,flagssize * sizeof(opj_flag_t));
1191 1193
1192 t1->w=w; 1194 t1->w=w;
1193 t1->h=h; 1195 t1->h=h;
1194 1196
1195 return OPJ_TRUE; 1197 return OPJ_TRUE;
1196 } 1198 }
1197 1199
1198 /* ----------------------------------------------------------------------- */ 1200 /* ----------------------------------------------------------------------- */
1199 1201
1200 /* ----------------------------------------------------------------------- */ 1202 /* ----------------------------------------------------------------------- */
1201 /** 1203 /**
1202 * Creates a new Tier 1 handle 1204 * Creates a new Tier 1 handle
1203 * and initializes the look-up tables of the Tier-1 coder/decoder 1205 * and initializes the look-up tables of the Tier-1 coder/decoder
1204 * @return a new T1 handle if successful, returns NULL otherwise 1206 * @return a new T1 handle if successful, returns NULL otherwise
1205 */ 1207 */
1206 opj_t1_t* opj_t1_create() 1208 opj_t1_t* opj_t1_create()
1207 { 1209 {
1208 opj_t1_t *l_t1 = 00; 1210 opj_t1_t *l_t1 = 00;
1209 1211
1210 » l_t1 = (opj_t1_t*) opj_malloc(sizeof(opj_t1_t)); 1212 » l_t1 = (opj_t1_t*) opj_calloc(1,sizeof(opj_t1_t));
1211 if (!l_t1) { 1213 if (!l_t1) {
1212 return 00; 1214 return 00;
1213 } 1215 }
1214 memset(l_t1,0,sizeof(opj_t1_t));
1215 1216
1216 /* create MQC and RAW handles */ 1217 /* create MQC and RAW handles */
1217 l_t1->mqc = opj_mqc_create(); 1218 l_t1->mqc = opj_mqc_create();
1218 if (! l_t1->mqc) { 1219 if (! l_t1->mqc) {
1219 opj_t1_destroy(l_t1); 1220 opj_t1_destroy(l_t1);
1220 return 00; 1221 return 00;
1221 } 1222 }
1222 1223
1223 l_t1->raw = opj_raw_create(); 1224 l_t1->raw = opj_raw_create();
1224 if (! l_t1->raw) { 1225 if (! l_t1->raw) {
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc(flag)) ; 1749 opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc(flag)) ;
1749 v = opj_mqc_decode(mqc) ^ opj_t1_getspb(flag); 1750 v = opj_mqc_decode(mqc) ^ opj_t1_getspb(flag);
1750 *datap = v ? -oneplushalf : oneplushalf; 1751 *datap = v ? -oneplushalf : oneplushalf;
1751 opj_t1_updateflags(flagsp, v, t1->flags_stride); 1752 opj_t1_updateflags(flagsp, v, t1->flags_stride);
1752 } 1753 }
1753 } 1754 }
1754 *flagsp |= T1_VISIT; 1755 *flagsp |= T1_VISIT;
1755 } 1756 }
1756 } /* VSC and BYPASS by Antonin */ 1757 } /* VSC and BYPASS by Antonin */
1757 #endif 1758 #endif
OLDNEW
« no previous file with comments | « core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/pi.c ('k') | core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/t2.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698