const uint8_t *val_table, int nb_codes,
int use_static, int is_ac)
{
- uint8_t huff_size[256];
+ uint8_t huff_size[256] = { 0 };
uint16_t huff_code[256];
uint16_t huff_sym[256];
int i;
assert(nb_codes <= 256);
- memset(huff_size, 0, sizeof(huff_size));
ff_mjpeg_build_huffman_codes(huff_size, huff_code, bits_table, val_table);
for (i = 0; i < 256; i++)
s->h_max = s->h_count[i];
if (s->v_count[i] > s->v_max)
s->v_max = s->v_count[i];
+ if (!s->h_count[i] || !s->v_count[i]) {
+ av_log(s->avctx, AV_LOG_ERROR, "h/v_count is 0\n");
+ return -1;
+ }
s->quant_index[i] = get_bits(&s->gb, 8);
if (s->quant_index[i] >= 4)
return -1;
av_log(s->avctx, AV_LOG_ERROR, "Unhandled pixel format 0x%x\n", pix_fmt_id);
return -1;
}
+ if ((s->upscale_h || s->upscale_v) && s->avctx->lowres) {
+ av_log(s->avctx, AV_LOG_ERROR, "lowres not supported for weird subsampling\n");
+ return AVERROR_PATCHWELCOME;
+ }
if (s->ls) {
s->upscale_h = s->upscale_v = 0;
if (s->nb_components > 1)
pred &= (-1)<<(8-s->bits);
*ptr= pred + (dc << point_transform);
}else{
- ptr16 = s->picture.data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x); //FIXME optimize this crap
+ ptr16 = (uint16_t*)(s->picture.data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x)); //FIXME optimize this crap
if(y==0 && toprow){
if(x==0 && leftcol){
pred= 1 << (bits - 1);
pred &= (-1)<<(8-s->bits);
*ptr = pred + (dc << point_transform);
}else{
- ptr16 = s->picture.data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x); //FIXME optimize this crap
+ ptr16 = (uint16_t*)(s->picture.data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x)); //FIXME optimize this crap
PREDICT(pred, ptr16[-linesize-1], ptr16[-linesize], ptr16[-1], predictor);
pred &= (-1)<<(16-s->bits);