#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "avcodec.h"
-#include "dsputil.h"
+#include "me_cmp.h"
#include "snow_dwt.h"
#include "internal.h"
#include "snow.h"
int ff_snow_get_buffer(SnowContext *s, AVFrame *frame)
{
int ret, i;
+ int edges_needed = av_codec_is_encoder(s->avctx->codec);
- frame->width = s->avctx->width + 2 * EDGE_WIDTH;
- frame->height = s->avctx->height + 2 * EDGE_WIDTH;
+ frame->width = s->avctx->width ;
+ frame->height = s->avctx->height;
+ if (edges_needed) {
+ frame->width += 2 * EDGE_WIDTH;
+ frame->height += 2 * EDGE_WIDTH;
+ }
if ((ret = ff_get_buffer(s->avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
- for (i = 0; frame->data[i]; i++) {
- int offset = (EDGE_WIDTH >> (i ? s->chroma_v_shift : 0)) *
- frame->linesize[i] +
- (EDGE_WIDTH >> (i ? s->chroma_h_shift : 0));
- frame->data[i] += offset;
+ if (edges_needed) {
+ for (i = 0; frame->data[i]; i++) {
+ int offset = (EDGE_WIDTH >> (i ? s->chroma_v_shift : 0)) *
+ frame->linesize[i] +
+ (EDGE_WIDTH >> (i ? s->chroma_h_shift : 0));
+ frame->data[i] += offset;
+ }
+ frame->width = s->avctx->width;
+ frame->height = s->avctx->height;
}
- frame->width = s->avctx->width;
- frame->height = s->avctx->height;
return 0;
}
s->avctx= avctx;
s->max_ref_frames=1; //just make sure it's not an invalid value in case of no initial keyframe
- ff_dsputil_init(&s->dsp, avctx);
+ ff_me_cmp_init(&s->mecc, avctx);
ff_hpeldsp_init(&s->hdsp, avctx->flags);
ff_videodsp_init(&s->vdsp, 8);
ff_dwt_init(&s->dwt);
ff_h264qpel_init(&s->h264qpel, 8);
- ff_mpegvideoencdsp_init(&s->mpvencdsp, avctx);
#define mcf(dx,dy)\
s->qdsp.put_qpel_pixels_tab [0][dy+dx/4]=\
int ff_snow_frame_start(SnowContext *s){
AVFrame *tmp;
int i, ret;
- int w= s->avctx->width; //FIXME round up to x16 ?
- int h= s->avctx->height;
-
- if (s->current_picture->data[0] && !(s->avctx->flags&CODEC_FLAG_EMU_EDGE)) {
- s->mpvencdsp.draw_edges(s->current_picture->data[0],
- s->current_picture->linesize[0], w , h ,
- EDGE_WIDTH , EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM);
- if (s->current_picture->data[2]) {
- s->mpvencdsp.draw_edges(s->current_picture->data[1],
- s->current_picture->linesize[1], w>>s->chroma_h_shift, h>>s->chroma_v_shift,
- EDGE_WIDTH>>s->chroma_h_shift, EDGE_WIDTH>>s->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM);
- s->mpvencdsp.draw_edges(s->current_picture->data[2],
- s->current_picture->linesize[2], w>>s->chroma_h_shift, h>>s->chroma_v_shift,
- EDGE_WIDTH>>s->chroma_h_shift, EDGE_WIDTH>>s->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM);
- }
- }
ff_snow_release_buffer(s->avctx);