218 for (coefi = Ss; coefi <= Se; coefi++) { 219 if (last_bitpos_ptr[coefi] < 0) { 220 /* first scan of this coefficient */ 221 if (Ah != 0) 222 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); 223 } else { 224 /* not first scan */ 225 if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1) 226 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); 227 } 228 last_bitpos_ptr[coefi] = Al; 229 } 230 } 231 #endif 232 } else { 233 /* For sequential JPEG, all progression parameters must be these: */ 234 if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0) 235 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); 236 /* Make sure components are not sent twice */ 237 for (ci = 0; ci < ncomps; ci++) { 238 thisi = scanptr->component_index[ci]; 239 if (component_sent[thisi]) 240 ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); 241 component_sent[thisi] = TRUE; 242 } 243 } 244 } 245 246 /* Now verify that everything got sent. */ 247 if (cinfo->progressive_mode) { 248 #ifdef C_PROGRESSIVE_SUPPORTED 249 /* For progressive mode, we only check that at least some DC data 250 * got sent for each component; the spec does not require that all bits 251 * of all coefficients be transmitted. Would it be wiser to enforce 252 * transmission of all coefficient bits?? 253 */ 254 for (ci = 0; ci < cinfo->num_components; ci++) { 255 if (last_bitpos[ci][0] < 0) 256 ERREXIT(cinfo, JERR_MISSING_DATA); 257 } 258 #endif | 218 for (coefi = Ss; coefi <= Se; coefi++) { 219 if (last_bitpos_ptr[coefi] < 0) { 220 /* first scan of this coefficient */ 221 if (Ah != 0) 222 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); 223 } else { 224 /* not first scan */ 225 if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1) 226 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); 227 } 228 last_bitpos_ptr[coefi] = Al; 229 } 230 } 231 #endif 232 } else { 233 /* For sequential JPEG, all progression parameters must be these: */ 234 if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0) 235 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); 236 /* Make sure components are not sent twice */ 237 for (ci = 0; ci < ncomps; ci++) { 238 #ifdef __GNUC__ 239 #pragma GCC diagnostic ignored "-Warray-bounds" 240 #endif 241 thisi = scanptr->component_index[ci]; 242 243 if (component_sent[thisi]) 244 ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); 245 component_sent[thisi] = TRUE; 246 } 247 } 248 } 249 250 /* Now verify that everything got sent. */ 251 if (cinfo->progressive_mode) { 252 #ifdef C_PROGRESSIVE_SUPPORTED 253 /* For progressive mode, we only check that at least some DC data 254 * got sent for each component; the spec does not require that all bits 255 * of all coefficients be transmitted. Would it be wiser to enforce 256 * transmission of all coefficient bits?? 257 */ 258 for (ci = 0; ci < cinfo->num_components; ci++) { 259 if (last_bitpos[ci][0] < 0) 260 ERREXIT(cinfo, JERR_MISSING_DATA); 261 } 262 #endif |