comparison dnxhddec.c @ 5792:aa620757cceb libavcodec

10l, check 'i' validity before using it
author bcoudurier
date Mon, 08 Oct 2007 12:11:19 +0000
parents 562c3853f8dc
children 33c615713e26
comparison
equal deleted inserted replaced
5791:562c3853f8dc 5792:aa620757cceb
187 if (ctx->cid_table->ac_run_flag[index]) { 187 if (ctx->cid_table->ac_run_flag[index]) {
188 index2 = get_vlc2(&ctx->gb, ctx->run_vlc.table, DNXHD_VLC_BITS, 2); 188 index2 = get_vlc2(&ctx->gb, ctx->run_vlc.table, DNXHD_VLC_BITS, 2);
189 i += ctx->cid_table->run[index2]; 189 i += ctx->cid_table->run[index2];
190 } 190 }
191 191
192 if (i > 63) {
193 av_log(ctx->avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", n, i);
194 return;
195 }
196
192 j = ctx->scantable.permutated[i]; 197 j = ctx->scantable.permutated[i];
193 //av_log(ctx->avctx, AV_LOG_DEBUG, "j %d\n", j); 198 //av_log(ctx->avctx, AV_LOG_DEBUG, "j %d\n", j);
194 //av_log(ctx->avctx, AV_LOG_DEBUG, "level %d, weigth %d\n", level, weigth_matrix[i]); 199 //av_log(ctx->avctx, AV_LOG_DEBUG, "level %d, weigth %d\n", level, weigth_matrix[i]);
195 level = (2*level+1) * qscale * weigth_matrix[i]; 200 level = (2*level+1) * qscale * weigth_matrix[i];
196 if (weigth_matrix[i] != 32) // FIXME 10bit 201 if (weigth_matrix[i] != 32) // FIXME 10bit
197 level += 32; 202 level += 32;
198 level >>= 6; 203 level >>= 6;
199 level = (level^sign) - sign; 204 level = (level^sign) - sign;
200
201 if (i > 63) {
202 av_log(ctx->avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", n, i);
203 return;
204 }
205
206 //av_log(NULL, AV_LOG_DEBUG, "i %d, j %d, end level %d\n", i, j, level); 205 //av_log(NULL, AV_LOG_DEBUG, "i %d, j %d, end level %d\n", i, j, level);
207 block[j] = level; 206 block[j] = level;
208 } 207 }
209 } 208 }
210 209