static av_cold int encode_init(AVCodecContext *avctx)
{
SnowContext *s = avctx->priv_data;
- int plane_index;
+ int plane_index, ret;
if(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){
av_log(avctx, AV_LOG_ERROR, "This codec is under development, files encoded with it may not be decodable with future versions!!!\n"
s->plane[plane_index].fast_mc= 1;
}
- ff_snow_common_init(avctx);
+ if ((ret = ff_snow_common_init(avctx)) < 0) {
+ ff_snow_common_end(avctx->priv_data);
+ return ret;
+ }
ff_snow_alloc_blocks(s);
s->version=0;
}
}
- s->runs = av_malloc(avctx->width * avctx->height * sizeof(*s->runs));
-
return 0;
}
uint8_t *src= s-> input_picture.data[plane_index];
IDWTELEM *pred= (IDWTELEM*)s->m.obmc_scratchpad + plane_index*block_size*block_size*4;
uint8_t *cur = s->scratchbuf;
- uint8_t tmp[ref_stride*(2*MB_SIZE+HTAPS_MAX-1)];
+ uint8_t *tmp = s->emu_edge_buffer;
const int b_stride = s->b_width << s->block_max_depth;
const int b_height = s->b_height<< s->block_max_depth;
const int w= p->width;
if(1){
int run=0;
+ int *runs = s->run_buffer;
int run_index=0;
int max_index;
}
if(!(/*ll|*/l|lt|t|rt|p)){
if(v){
- s->runs[run_index++]= run;
+ runs[run_index++]= run;
run=0;
}else{
run++;
}
}
max_index= run_index;
- s->runs[run_index++]= run;
+ runs[run_index++]= run;
run_index=0;
- run= s->runs[run_index++];
+ run= runs[run_index++];
put_symbol2(&s->c, b->state[30], max_index, 0);
if(run_index <= max_index)
put_rac(&s->c, &b->state[0][context], !!v);
}else{
if(!run){
- run= s->runs[run_index++];
+ run= runs[run_index++];
if(run_index <= max_index)
put_symbol2(&s->c, b->state[1], run, 3);
static av_always_inline int check_4block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, int ref, int *best_rd){
const int b_stride= s->b_width << s->block_max_depth;
BlockNode *block= &s->block[mb_x + mb_y * b_stride];
- BlockNode backup[4]= {block[0], block[1], block[b_stride], block[b_stride+1]};
+ BlockNode backup[4];
unsigned value;
int rd, index;
+ /* We don't initialize backup[] during variable declaration, because
+ * that fails to compile on MSVC: "cannot convert from 'BlockNode' to
+ * 'int16_t'". */
+ backup[0] = block[0];
+ backup[1] = block[1];
+ backup[2] = block[b_stride];
+ backup[3] = block[b_stride + 1];
+
assert(mb_x>=0 && mb_y>=0);
assert(mb_x<b_stride);
assert(((mb_x|mb_y)&1) == 0);
if (s->input_picture.data[0])
avctx->release_buffer(avctx, &s->input_picture);
av_free(avctx->stats_out);
- av_freep(&s->runs);
return 0;
}
.init = encode_init,
.encode2 = encode_frame,
.close = encode_end,
+ .pix_fmts = (const enum PixelFormat[]){
+ PIX_FMT_YUV420P, PIX_FMT_YUV410P, PIX_FMT_YUV444P,
+ PIX_FMT_NONE
+ },
.long_name = NULL_IF_CONFIG_SMALL("Snow"),
.priv_class = &snowenc_class,
};