static inline void decode_subband_slice_buffered(SnowContext *s, SubBand *b, slice_buffer * sb, int start_y, int h, int save_state[1]){
const int w= b->width;
int y;
- const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);
+ const int qlog= av_clip(s->qlog + (int64_t)b->qlog, 0, QROOT*16);
int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
int qadd= (s->qbias*qmul)>>QBIAS_SHIFT;
int new_index = 0;
static void dequantize_slice_buffered(SnowContext *s, slice_buffer * sb, SubBand *b, IDWTELEM *src, int stride, int start_y, int end_y){
const int w= b->width;
- const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);
+ const int qlog= av_clip(s->qlog + (int64_t)b->qlog, 0, QROOT*16);
const int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT;
int x,y;
htaps = htaps*2 + 2;
p->htaps= htaps;
for(i= htaps/2; i; i--){
- p->hcoeff[i]= get_symbol(&s->c, s->header_state, 0) * (1-2*(i&1));
+ unsigned hcoeff = get_symbol(&s->c, s->header_state, 0);
+ if (hcoeff > 127)
+ return AVERROR_INVALIDDATA;
+ p->hcoeff[i]= hcoeff * (1-2*(i&1));
sum += p->hcoeff[i];
}
p->hcoeff[0]= 32-sum;
return 0;
}
-static av_cold int decode_init(AVCodecContext *avctx)
-{
- int ret;
-
- if ((ret = ff_snow_common_init(avctx)) < 0) {
- return ret;
- }
-
- return 0;
-}
-
static int decode_blocks(SnowContext *s){
int x, y;
int w= s->b_width;
);
av_assert0(!s->avmv);
- if (s->avctx->flags2 & AV_CODEC_FLAG2_EXPORT_MVS) {
+ if (s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_MVS) {
s->avmv = av_malloc_array(s->b_width * s->b_height, sizeof(AVMotionVector) << (s->block_max_depth*2));
}
s->avmv_index = 0;
return 0;
}
-AVCodec ff_snow_decoder = {
+const AVCodec ff_snow_decoder = {
.name = "snow",
.long_name = NULL_IF_CONFIG_SMALL("Snow"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_SNOW,
.priv_data_size = sizeof(SnowContext),
- .init = decode_init,
+ .init = ff_snow_common_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = AV_CODEC_CAP_DR1 /*| AV_CODEC_CAP_DRAW_HORIZ_BAND*/,