#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "internal.h"
+#include "packet_internal.h"
#include "snow_dwt.h"
#include "snow.h"
s->m.bit_rate= avctx->bit_rate;
s->m.lmin = avctx->mb_lmin;
s->m.lmax = avctx->mb_lmax;
+ s->m.mb_num = (avctx->width * avctx->height + 255) / 256; // For ratecontrol
s->m.me.temp =
s->m.me.scratchpad= av_mallocz_array((avctx->width+64), 2*16*2*sizeof(uint8_t));
if(P_LEFT[1] > (c->ymax<<shift)) P_LEFT[1] = (c->ymax<<shift);
if(P_TOP[0] > (c->xmax<<shift)) P_TOP[0] = (c->xmax<<shift);
if(P_TOP[1] > (c->ymax<<shift)) P_TOP[1] = (c->ymax<<shift);
- if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift);
+ if(P_TOPRIGHT[0] < (c->xmin * (1<<shift))) P_TOPRIGHT[0]= (c->xmin * (1<<shift));
if(P_TOPRIGHT[0] > (c->xmax<<shift)) P_TOPRIGHT[0]= (c->xmax<<shift); //due to pmx no clip
if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift);
s->lambda = 0;
}//else keep previous frame's qlog until after motion estimation
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+ av_frame_unref(avctx->coded_frame);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
if (s->current_picture->data[0]) {
int w = s->avctx->width;
int h = s->avctx->height;
+#if FF_API_CODED_FRAME
+ ret = av_frame_make_writable(s->current_picture);
+ if (ret < 0)
+ return ret;
+#endif
+
s->mpvencdsp.draw_edges(s->current_picture->data[0],
s->current_picture->linesize[0], w , h ,
EDGE_WIDTH , EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM);
ff_snow_frame_start(s);
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
- av_frame_unref(avctx->coded_frame);
ret = av_frame_ref(avctx->coded_frame, s->current_picture);
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}else{
for(y=0; y<h; y++){
for(x=0; x<w; x++){
- s->spatial_dwt_buffer[y*w + x]=s->spatial_idwt_buffer[y*w + x]<<ENCODER_EXTRA_BITS;
+ s->spatial_dwt_buffer[y*w + x]= s->spatial_idwt_buffer[y*w + x] * (1 << ENCODER_EXTRA_BITS);
}
}
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
- pkt->size = ff_rac_terminate(c);
+ pkt->size = ff_rac_terminate(c, 0);
if (s->current_picture->key_frame)
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;