---
libavcodec/snow.c | 358 ++++++++++++++++++++++++++++++++++++++
libavcodec/snow.h | 32 ++++-
libavcodec/snowdata.h | 7 +
libavcodec/snowdec.c | 461 +------------------------------------------------
libavcodec/snowenc.c | 394 +-----------------------------------------
5 files changed, 407 insertions(+), 845 deletions(-)
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 1190593..65adf88 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -29,6 +29,7 @@
#include "rangecoder.h"
#include "mathops.h"
+#include "h263.h"
#undef NDEBUG
#include <assert.h>
@@ -92,3 +93,360 @@ int snow_alloc_blocks(SnowContext *s){
s->block= av_mallocz(w * h * sizeof(BlockNode) << (s->block_max_depth*2));
return 0;
}
+
+static void init_qexp(void){
+ int i;
+ double v=128;
+
+ for(i=0; i<QROOT; i++){
+ qexp[i]= lrintf(v);
+ v *= pow(2, 1.0 / QROOT);
+ }
+}
+static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, int stride,
int b_w, int b_h, int dx, int dy){
+ static const uint8_t weight[64]={
+ 8,7,6,5,4,3,2,1,
+ 7,7,0,0,0,0,0,1,
+ 6,0,6,0,0,0,2,0,
+ 5,0,0,5,0,3,0,0,
+ 4,0,0,0,4,0,0,0,
+ 3,0,0,5,0,3,0,0,
+ 2,0,6,0,0,0,2,0,
+ 1,7,0,0,0,0,0,1,
+ };
+
+ static const uint8_t brane[256]={
+
0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
+
0x04,0x05,0xcc,0xcc,0xcc,0xcc,0xcc,0x41,0x15,0x16,0xcc,0xcc,0xcc,0xcc,0xcc,0x52,
+
0x04,0xcc,0x05,0xcc,0xcc,0xcc,0x41,0xcc,0x15,0xcc,0x16,0xcc,0xcc,0xcc,0x52,0xcc,
+
0x04,0xcc,0xcc,0x05,0xcc,0x41,0xcc,0xcc,0x15,0xcc,0xcc,0x16,0xcc,0x52,0xcc,0xcc,
+
0x04,0xcc,0xcc,0xcc,0x41,0xcc,0xcc,0xcc,0x15,0xcc,0xcc,0xcc,0x16,0xcc,0xcc,0xcc,
+
0x04,0xcc,0xcc,0x41,0xcc,0x05,0xcc,0xcc,0x15,0xcc,0xcc,0x52,0xcc,0x16,0xcc,0xcc,
+
0x04,0xcc,0x41,0xcc,0xcc,0xcc,0x05,0xcc,0x15,0xcc,0x52,0xcc,0xcc,0xcc,0x16,0xcc,
+
0x04,0x41,0xcc,0xcc,0xcc,0xcc,0xcc,0x05,0x15,0x52,0xcc,0xcc,0xcc,0xcc,0xcc,0x16,
+
0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x56,
+
0x48,0x49,0xcc,0xcc,0xcc,0xcc,0xcc,0x85,0x59,0x5A,0xcc,0xcc,0xcc,0xcc,0xcc,0x96,
+
0x48,0xcc,0x49,0xcc,0xcc,0xcc,0x85,0xcc,0x59,0xcc,0x5A,0xcc,0xcc,0xcc,0x96,0xcc,
+
0x48,0xcc,0xcc,0x49,0xcc,0x85,0xcc,0xcc,0x59,0xcc,0xcc,0x5A,0xcc,0x96,0xcc,0xcc,
+
0x48,0xcc,0xcc,0xcc,0x49,0xcc,0xcc,0xcc,0x59,0xcc,0xcc,0xcc,0x96,0xcc,0xcc,0xcc,
+
0x48,0xcc,0xcc,0x85,0xcc,0x49,0xcc,0xcc,0x59,0xcc,0xcc,0x96,0xcc,0x5A,0xcc,0xcc,
+
0x48,0xcc,0x85,0xcc,0xcc,0xcc,0x49,0xcc,0x59,0xcc,0x96,0xcc,0xcc,0xcc,0x5A,0xcc,
+
0x48,0x85,0xcc,0xcc,0xcc,0xcc,0xcc,0x49,0x59,0x96,0xcc,0xcc,0xcc,0xcc,0xcc,0x5A,
+ };
+
+ static const uint8_t needs[16]={
+ 0,1,0,0,
+ 2,4,2,0,
+ 0,1,0,0,
+ 15
+ };
+
+ int x, y, b, r, l;
+ int16_t tmpIt [64*(32+HTAPS_MAX)];
+ uint8_t tmp2t[3][stride*(32+HTAPS_MAX)];
+ int16_t *tmpI= tmpIt;
+ uint8_t *tmp2= tmp2t[0];
+ const uint8_t *hpel[11];
+ assert(dx<16 && dy<16);
+ r= brane[dx + 16*dy]&15;
+ l= brane[dx + 16*dy]>>4;
+
+ b= needs[l] | needs[r];
+ if(p && !p->diag_mc)
+ b= 15;
+
+ if(b&5){
+ for(y=0; y < b_h+HTAPS_MAX-1; y++){
+ for(x=0; x < b_w; x++){
+ int a_1=src[x + HTAPS_MAX/2-4];
+ int a0= src[x + HTAPS_MAX/2-3];
+ int a1= src[x + HTAPS_MAX/2-2];
+ int a2= src[x + HTAPS_MAX/2-1];
+ int a3= src[x + HTAPS_MAX/2+0];
+ int a4= src[x + HTAPS_MAX/2+1];
+ int a5= src[x + HTAPS_MAX/2+2];
+ int a6= src[x + HTAPS_MAX/2+3];
+ int am=0;
+ if(!p || p->fast_mc){
+ am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5);
+ tmpI[x]= am;
+ am= (am+16)>>5;
+ }else{
+ am= p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) +
p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6);
+ tmpI[x]= am;
+ am= (am+32)>>6;
+ }
+
+ if(am&(~255)) am= ~(am>>31);
+ tmp2[x]= am;
+ }
+ tmpI+= 64;
+ tmp2+= stride;
+ src += stride;
+ }
+ src -= stride*y;
+ }
+ src += HTAPS_MAX/2 - 1;
+ tmp2= tmp2t[1];
+
+ if(b&2){
+ for(y=0; y < b_h; y++){
+ for(x=0; x < b_w+1; x++){
+ int a_1=src[x + (HTAPS_MAX/2-4)*stride];
+ int a0= src[x + (HTAPS_MAX/2-3)*stride];
+ int a1= src[x + (HTAPS_MAX/2-2)*stride];
+ int a2= src[x + (HTAPS_MAX/2-1)*stride];
+ int a3= src[x + (HTAPS_MAX/2+0)*stride];
+ int a4= src[x + (HTAPS_MAX/2+1)*stride];
+ int a5= src[x + (HTAPS_MAX/2+2)*stride];
+ int a6= src[x + (HTAPS_MAX/2+3)*stride];
+ int am=0;
+ if(!p || p->fast_mc)
+ am= (20*(a2+a3) - 5*(a1+a4) + (a0+a5) + 16)>>5;
+ else
+ am= (p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) +
p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6) + 32)>>6;
+
+ if(am&(~255)) am= ~(am>>31);
+ tmp2[x]= am;
+ }
+ src += stride;
+ tmp2+= stride;
+ }
+ src -= stride*y;
+ }
+ src += stride*(HTAPS_MAX/2 - 1);
+ tmp2= tmp2t[2];
+ tmpI= tmpIt;
+ if(b&4){
+ for(y=0; y < b_h; y++){
+ for(x=0; x < b_w; x++){
+ int a_1=tmpI[x + (HTAPS_MAX/2-4)*64];
+ int a0= tmpI[x + (HTAPS_MAX/2-3)*64];
+ int a1= tmpI[x + (HTAPS_MAX/2-2)*64];
+ int a2= tmpI[x + (HTAPS_MAX/2-1)*64];
+ int a3= tmpI[x + (HTAPS_MAX/2+0)*64];
+ int a4= tmpI[x + (HTAPS_MAX/2+1)*64];
+ int a5= tmpI[x + (HTAPS_MAX/2+2)*64];
+ int a6= tmpI[x + (HTAPS_MAX/2+3)*64];
+ int am=0;
+ if(!p || p->fast_mc)
+ am= (20*(a2+a3) - 5*(a1+a4) + (a0+a5) + 512)>>10;
+ else
+ am= (p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) +
p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6) + 2048)>>12;
+ if(am&(~255)) am= ~(am>>31);
+ tmp2[x]= am;
+ }
+ tmpI+= 64;
+ tmp2+= stride;
+ }
+ }
+
+ hpel[ 0]= src;
+ hpel[ 1]= tmp2t[0] + stride*(HTAPS_MAX/2-1);
+ hpel[ 2]= src + 1;
+
+ hpel[ 4]= tmp2t[1];
+ hpel[ 5]= tmp2t[2];
+ hpel[ 6]= tmp2t[1] + 1;
+
+ hpel[ 8]= src + stride;
+ hpel[ 9]= hpel[1] + stride;
+ hpel[10]= hpel[8] + 1;
+
+ if(b==15){
+ const uint8_t *src1= hpel[dx/8 + dy/8*4 ];
+ const uint8_t *src2= hpel[dx/8 + dy/8*4+1];
+ const uint8_t *src3= hpel[dx/8 + dy/8*4+4];
+ const uint8_t *src4= hpel[dx/8 + dy/8*4+5];
+ dx&=7;
+ dy&=7;
+ for(y=0; y < b_h; y++){
+ for(x=0; x < b_w; x++){
+ dst[x]= ((8-dx)*(8-dy)*src1[x] + dx*(8-dy)*src2[x]+
+ (8-dx)* dy *src3[x] + dx* dy *src4[x]+32)>>6;
+ }
+ src1+=stride;
+ src2+=stride;
+ src3+=stride;
+ src4+=stride;
+ dst +=stride;
+ }
+ }else{
+ const uint8_t *src1= hpel[l];
+ const uint8_t *src2= hpel[r];
+ int a= weight[((dx&7) + (8*(dy&7)))];
+ int b= 8-a;
+ for(y=0; y < b_h; y++){
+ for(x=0; x < b_w; x++){
+ dst[x]= (a*src1[x] + b*src2[x] + 4)>>3;
+ }
+ src1+=stride;
+ src2+=stride;
+ dst +=stride;
+ }
+ }
+}
+
+void snow_pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride,
int sx, int sy, int b_w, int b_h, BlockNode *block, int plane_index, int w, int
h){
+ if(block->type & BLOCK_INTRA){
+ int x, y;
+ const int color = block->color[plane_index];
+ const int color4= color*0x01010101;
+ if(b_w==32){
+ for(y=0; y < b_h; y++){
+ *(uint32_t*)&dst[0 + y*stride]= color4;
+ *(uint32_t*)&dst[4 + y*stride]= color4;
+ *(uint32_t*)&dst[8 + y*stride]= color4;
+ *(uint32_t*)&dst[12+ y*stride]= color4;
+ *(uint32_t*)&dst[16+ y*stride]= color4;
+ *(uint32_t*)&dst[20+ y*stride]= color4;
+ *(uint32_t*)&dst[24+ y*stride]= color4;
+ *(uint32_t*)&dst[28+ y*stride]= color4;
+ }
+ }else if(b_w==16){
+ for(y=0; y < b_h; y++){
+ *(uint32_t*)&dst[0 + y*stride]= color4;
+ *(uint32_t*)&dst[4 + y*stride]= color4;
+ *(uint32_t*)&dst[8 + y*stride]= color4;
+ *(uint32_t*)&dst[12+ y*stride]= color4;
+ }
+ }else if(b_w==8){
+ for(y=0; y < b_h; y++){
+ *(uint32_t*)&dst[0 + y*stride]= color4;
+ *(uint32_t*)&dst[4 + y*stride]= color4;
+ }
+ }else if(b_w==4){
+ for(y=0; y < b_h; y++){
+ *(uint32_t*)&dst[0 + y*stride]= color4;
+ }
+ }else{
+ for(y=0; y < b_h; y++){
+ for(x=0; x < b_w; x++){
+ dst[x + y*stride]= color;
+ }
+ }
+ }
+ }else{
+ uint8_t *src= s->last_picture[block->ref].data[plane_index];
+ const int scale= plane_index ? s->mv_scale : 2*s->mv_scale;
+ int mx= block->mx*scale;
+ int my= block->my*scale;
+ const int dx= mx&15;
+ const int dy= my&15;
+ const int tab_index= 3 - (b_w>>2) + (b_w>>4);
+ sx += (mx>>4) - (HTAPS_MAX/2-1);
+ sy += (my>>4) - (HTAPS_MAX/2-1);
+ src += sx + sy*stride;
+ if( (unsigned)sx >= w - b_w - (HTAPS_MAX-2)
+ || (unsigned)sy >= h - b_h - (HTAPS_MAX-2)){
+ s->dsp.emulated_edge_mc(tmp + MB_SIZE, src, stride,
b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h);
+ src= tmp + MB_SIZE;
+ }
+// assert(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h);
+// assert(!(b_w&(b_w-1)));
+ assert(b_w>1 && b_h>1);
+ assert((tab_index>=0 && tab_index<4) || b_w==32);
+ if((dx&3) || (dy&3) || !(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h)
|| (b_w&(b_w-1)) || !s->plane[plane_index].fast_mc )
+ mc_block(&s->plane[plane_index], dst, src, stride, b_w, b_h, dx,
dy);
+ else if(b_w==32){
+ int y;
+ for(y=0; y<b_h; y+=16){
+ s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + y*stride,
src + 3 + (y+3)*stride,stride);
+ s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + 16 +
y*stride, src + 19 + (y+3)*stride,stride);
+ }
+ }else if(b_w==b_h)
+ s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst,src +
3 + 3*stride,stride);
+ else if(b_w==2*b_h){
+ s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst
,src + 3 + 3*stride,stride);
+
s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst+b_h,src + 3 + b_h
+ 3*stride,stride);
+ }else{
+ assert(2*b_w==b_h);
+ s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst
,src + 3 + 3*stride ,stride);
+ s->dsp.put_h264_qpel_pixels_tab[tab_index
][dy+(dx>>2)](dst+b_w*stride,src + 3 + 3*stride+b_w*stride,stride);
+ }
+ }
+}
+
+#define mca(dx,dy,b_w)\
+static void mc_block_hpel ## dx ## dy ## b_w(uint8_t *dst, const uint8_t *src,
int stride, int h){\
+ assert(h==b_w);\
+ mc_block(NULL, dst, src-(HTAPS_MAX/2-1)-(HTAPS_MAX/2-1)*stride, stride,
b_w, b_w, dx, dy);\
+}
+
+mca( 0, 0,16)
+mca( 8, 0,16)
+mca( 0, 8,16)
+mca( 8, 8,16)
+mca( 0, 0,8)
+mca( 8, 0,8)
+mca( 0, 8,8)
+mca( 8, 8,8)
+
+av_cold int snow_common_init(AVCodecContext *avctx){
+ SnowContext *s = avctx->priv_data;
+ int width, height;
+ int i, j;
+
+ s->avctx= avctx;
+ s->max_ref_frames=1; //just make sure its not an invalid value in case of
no initial keyframe
+
+ dsputil_init(&s->dsp, avctx);
+ ff_dwt_init(&s->dwt);
+
+#define mcf(dx,dy)\
+ s->dsp.put_qpel_pixels_tab [0][dy+dx/4]=\
+ s->dsp.put_no_rnd_qpel_pixels_tab[0][dy+dx/4]=\
+ s->dsp.put_h264_qpel_pixels_tab[0][dy+dx/4];\
+ s->dsp.put_qpel_pixels_tab [1][dy+dx/4]=\
+ s->dsp.put_no_rnd_qpel_pixels_tab[1][dy+dx/4]=\
+ s->dsp.put_h264_qpel_pixels_tab[1][dy+dx/4];
+
+ mcf( 0, 0)
+ mcf( 4, 0)
+ mcf( 8, 0)
+ mcf(12, 0)
+ mcf( 0, 4)
+ mcf( 4, 4)
+ mcf( 8, 4)
+ mcf(12, 4)
+ mcf( 0, 8)
+ mcf( 4, 8)
+ mcf( 8, 8)
+ mcf(12, 8)
+ mcf( 0,12)
+ mcf( 4,12)
+ mcf( 8,12)
+ mcf(12,12)
+
+#define mcfh(dx,dy)\
+ s->dsp.put_pixels_tab [0][dy/4+dx/8]=\
+ s->dsp.put_no_rnd_pixels_tab[0][dy/4+dx/8]=\
+ mc_block_hpel ## dx ## dy ## 16;\
+ s->dsp.put_pixels_tab [1][dy/4+dx/8]=\
+ s->dsp.put_no_rnd_pixels_tab[1][dy/4+dx/8]=\
+ mc_block_hpel ## dx ## dy ## 8;
+
+ mcfh(0, 0)
+ mcfh(8, 0)
+ mcfh(0, 8)
+ mcfh(8, 8)
+
+ init_qexp();
+
+// dec += FFMAX(s->chroma_h_shift, s->chroma_v_shift);
+
+ width= s->avctx->width;
+ height= s->avctx->height;
+
+ s->spatial_idwt_buffer= av_mallocz(width*height*sizeof(IDWTELEM));
+ s->spatial_dwt_buffer= av_mallocz(width*height*sizeof(DWTELEM)); //FIXME
this does not belong here
+
+ for(i=0; i<MAX_REF_FRAMES; i++)
+ for(j=0; j<MAX_REF_FRAMES; j++)
+ scale_mv_ref[i][j] = 256*(i+1)/(j+1);
+
+ s->avctx->get_buffer(s->avctx, &s->mconly_picture);
+ s->scratchbuf = av_malloc(s->mconly_picture.linesize[0]*7*MB_SIZE);
+
+ return 0;
+}
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index c5d2b49..831613d 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -166,6 +166,12 @@ typedef struct SnowContext{
/* Tables */
extern const uint8_t * const obmc_tab[4];
+#ifdef __sgi
+// Avoid a name clash on SGI IRIX
+#undef qexp
+#endif
+extern uint8_t qexp[QROOT];
+extern int scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
/* C bits used by mmx/sse2/altivec */
@@ -205,6 +211,9 @@ static av_always_inline void
snow_horizontal_compose_liftS_lead_out(int i, IDWTE
}
}
+/* common inline functions */
+//XXX doublecheck all of them should stay inlined
+
static inline void snow_set_blocks(SnowContext *s, int level, int x, int y,
int l, int cb, int cr, int mx, int my, int ref, int type){
const int w= s->b_width << s->block_max_depth;
const int rem_depth= s->block_max_depth - level;
@@ -229,7 +238,28 @@ static inline void snow_set_blocks(SnowContext *s, int
level, int x, int y, int
}
}
+static inline void pred_mv(SnowContext *s, int *mx, int *my, int ref,
+ const BlockNode *left, const BlockNode *top, const
BlockNode *tr){
+ if(s->ref_frames == 1){
+ *mx = mid_pred(left->mx, top->mx, tr->mx);
+ *my = mid_pred(left->my, top->my, tr->my);
+ }else{
+ const int *scale = scale_mv_ref[ref];
+ *mx = mid_pred((left->mx * scale[left->ref] + 128) >>8,
+ (top ->mx * scale[top ->ref] + 128) >>8,
+ (tr ->mx * scale[tr ->ref] + 128) >>8);
+ *my = mid_pred((left->my * scale[left->ref] + 128) >>8,
+ (top ->my * scale[top ->ref] + 128) >>8,
+ (tr ->my * scale[tr ->ref] + 128) >>8);
+ }
+}
+
+/* common code */
+
void snow_reset_contexts(SnowContext *s);
int snow_alloc_blocks(SnowContext *s);
-
+int snow_common_init(AVCodecContext *avctx);
+void snow_pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride,
+ int sx, int sy, int b_w, int b_h, BlockNode *block,
+ int plane_index, int w, int h);
#endif /* AVCODEC_SNOW_H */
diff --git a/libavcodec/snowdata.h b/libavcodec/snowdata.h
index 161c1b4..f1e8218 100644
--- a/libavcodec/snowdata.h
+++ b/libavcodec/snowdata.h
@@ -22,6 +22,8 @@
#ifndef AVCODEC_SNOWDATA_H
#define AVCODEC_SNOWDATA_H
+#include "snow.h"
+
static const uint8_t obmc32[1024]={
0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8,
8, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0,
0, 4, 4, 4, 8, 8, 8, 12, 12, 16, 16, 16, 20, 20, 20, 24, 24, 20, 20,
20, 16, 16, 16, 12, 12, 8, 8, 8, 4, 4, 4, 0,
@@ -103,4 +105,9 @@ const uint8_t * const obmc_tab[4]= {
obmc32, obmc16, obmc8, obmc4
};
+/* runtime generated tables */
+uint8_t qexp[QROOT];
+int scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
+
+
#endif /* AVCODEC_SNOW_H */
diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
index fab8993..7d891bb 100644
--- a/libavcodec/snowdec.c
+++ b/libavcodec/snowdec.c
@@ -54,14 +54,7 @@ static const int8_t quant3bA[256]={
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
};
-static int scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
-
-#ifdef __sgi
-// Avoid a name clash on SGI IRIX
-#undef qexp
-#endif
#define QEXPSHIFT (7-FRAC_BITS+8) //FIXME try to change this to 0
-static uint8_t qexp[QROOT];
static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int
is_signed){
int i;
@@ -290,22 +283,6 @@ static inline void init_ref(MotionEstContext *c, uint8_t
*src[3], uint8_t *ref[3
assert(!ref_index);
}
-static inline void pred_mv(SnowContext *s, int *mx, int *my, int ref,
- const BlockNode *left, const BlockNode *top, const
BlockNode *tr){
- if(s->ref_frames == 1){
- *mx = mid_pred(left->mx, top->mx, tr->mx);
- *my = mid_pred(left->my, top->my, tr->my);
- }else{
- const int *scale = scale_mv_ref[ref];
- *mx = mid_pred((left->mx * scale[left->ref] + 128) >>8,
- (top ->mx * scale[top ->ref] + 128) >>8,
- (tr ->mx * scale[tr ->ref] + 128) >>8);
- *my = mid_pred((left->my * scale[left->ref] + 128) >>8,
- (top ->my * scale[top ->ref] + 128) >>8,
- (tr ->my * scale[tr ->ref] + 128) >>8);
- }
-}
-
static av_always_inline int same_block(BlockNode *a, BlockNode *b){
if((a->type&BLOCK_INTRA) && (b->type&BLOCK_INTRA)){
return !((a->color[0] - b->color[0]) | (a->color[1] - b->color[1]) |
(a->color[2] - b->color[2]));
@@ -314,285 +291,6 @@ static av_always_inline int same_block(BlockNode *a,
BlockNode *b){
}
}
-static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, int stride,
int b_w, int b_h, int dx, int dy){
- static const uint8_t weight[64]={
- 8,7,6,5,4,3,2,1,
- 7,7,0,0,0,0,0,1,
- 6,0,6,0,0,0,2,0,
- 5,0,0,5,0,3,0,0,
- 4,0,0,0,4,0,0,0,
- 3,0,0,5,0,3,0,0,
- 2,0,6,0,0,0,2,0,
- 1,7,0,0,0,0,0,1,
- };
-
- static const uint8_t brane[256]={
-
0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
-
0x04,0x05,0xcc,0xcc,0xcc,0xcc,0xcc,0x41,0x15,0x16,0xcc,0xcc,0xcc,0xcc,0xcc,0x52,
-
0x04,0xcc,0x05,0xcc,0xcc,0xcc,0x41,0xcc,0x15,0xcc,0x16,0xcc,0xcc,0xcc,0x52,0xcc,
-
0x04,0xcc,0xcc,0x05,0xcc,0x41,0xcc,0xcc,0x15,0xcc,0xcc,0x16,0xcc,0x52,0xcc,0xcc,
-
0x04,0xcc,0xcc,0xcc,0x41,0xcc,0xcc,0xcc,0x15,0xcc,0xcc,0xcc,0x16,0xcc,0xcc,0xcc,
-
0x04,0xcc,0xcc,0x41,0xcc,0x05,0xcc,0xcc,0x15,0xcc,0xcc,0x52,0xcc,0x16,0xcc,0xcc,
-
0x04,0xcc,0x41,0xcc,0xcc,0xcc,0x05,0xcc,0x15,0xcc,0x52,0xcc,0xcc,0xcc,0x16,0xcc,
-
0x04,0x41,0xcc,0xcc,0xcc,0xcc,0xcc,0x05,0x15,0x52,0xcc,0xcc,0xcc,0xcc,0xcc,0x16,
-
0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x56,
-
0x48,0x49,0xcc,0xcc,0xcc,0xcc,0xcc,0x85,0x59,0x5A,0xcc,0xcc,0xcc,0xcc,0xcc,0x96,
-
0x48,0xcc,0x49,0xcc,0xcc,0xcc,0x85,0xcc,0x59,0xcc,0x5A,0xcc,0xcc,0xcc,0x96,0xcc,
-
0x48,0xcc,0xcc,0x49,0xcc,0x85,0xcc,0xcc,0x59,0xcc,0xcc,0x5A,0xcc,0x96,0xcc,0xcc,
-
0x48,0xcc,0xcc,0xcc,0x49,0xcc,0xcc,0xcc,0x59,0xcc,0xcc,0xcc,0x96,0xcc,0xcc,0xcc,
-
0x48,0xcc,0xcc,0x85,0xcc,0x49,0xcc,0xcc,0x59,0xcc,0xcc,0x96,0xcc,0x5A,0xcc,0xcc,
-
0x48,0xcc,0x85,0xcc,0xcc,0xcc,0x49,0xcc,0x59,0xcc,0x96,0xcc,0xcc,0xcc,0x5A,0xcc,
-
0x48,0x85,0xcc,0xcc,0xcc,0xcc,0xcc,0x49,0x59,0x96,0xcc,0xcc,0xcc,0xcc,0xcc,0x5A,
- };
-
- static const uint8_t needs[16]={
- 0,1,0,0,
- 2,4,2,0,
- 0,1,0,0,
- 15
- };
-
- int x, y, b, r, l;
- int16_t tmpIt [64*(32+HTAPS_MAX)];
- uint8_t tmp2t[3][stride*(32+HTAPS_MAX)];
- int16_t *tmpI= tmpIt;
- uint8_t *tmp2= tmp2t[0];
- const uint8_t *hpel[11];
- assert(dx<16 && dy<16);
- r= brane[dx + 16*dy]&15;
- l= brane[dx + 16*dy]>>4;
-
- b= needs[l] | needs[r];
- if(p && !p->diag_mc)
- b= 15;
-
- if(b&5){
- for(y=0; y < b_h+HTAPS_MAX-1; y++){
- for(x=0; x < b_w; x++){
- int a_1=src[x + HTAPS_MAX/2-4];
- int a0= src[x + HTAPS_MAX/2-3];
- int a1= src[x + HTAPS_MAX/2-2];
- int a2= src[x + HTAPS_MAX/2-1];
- int a3= src[x + HTAPS_MAX/2+0];
- int a4= src[x + HTAPS_MAX/2+1];
- int a5= src[x + HTAPS_MAX/2+2];
- int a6= src[x + HTAPS_MAX/2+3];
- int am=0;
- if(!p || p->fast_mc){
- am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5);
- tmpI[x]= am;
- am= (am+16)>>5;
- }else{
- am= p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) +
p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6);
- tmpI[x]= am;
- am= (am+32)>>6;
- }
-
- if(am&(~255)) am= ~(am>>31);
- tmp2[x]= am;
- }
- tmpI+= 64;
- tmp2+= stride;
- src += stride;
- }
- src -= stride*y;
- }
- src += HTAPS_MAX/2 - 1;
- tmp2= tmp2t[1];
-
- if(b&2){
- for(y=0; y < b_h; y++){
- for(x=0; x < b_w+1; x++){
- int a_1=src[x + (HTAPS_MAX/2-4)*stride];
- int a0= src[x + (HTAPS_MAX/2-3)*stride];
- int a1= src[x + (HTAPS_MAX/2-2)*stride];
- int a2= src[x + (HTAPS_MAX/2-1)*stride];
- int a3= src[x + (HTAPS_MAX/2+0)*stride];
- int a4= src[x + (HTAPS_MAX/2+1)*stride];
- int a5= src[x + (HTAPS_MAX/2+2)*stride];
- int a6= src[x + (HTAPS_MAX/2+3)*stride];
- int am=0;
- if(!p || p->fast_mc)
- am= (20*(a2+a3) - 5*(a1+a4) + (a0+a5) + 16)>>5;
- else
- am= (p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) +
p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6) + 32)>>6;
-
- if(am&(~255)) am= ~(am>>31);
- tmp2[x]= am;
- }
- src += stride;
- tmp2+= stride;
- }
- src -= stride*y;
- }
- src += stride*(HTAPS_MAX/2 - 1);
- tmp2= tmp2t[2];
- tmpI= tmpIt;
- if(b&4){
- for(y=0; y < b_h; y++){
- for(x=0; x < b_w; x++){
- int a_1=tmpI[x + (HTAPS_MAX/2-4)*64];
- int a0= tmpI[x + (HTAPS_MAX/2-3)*64];
- int a1= tmpI[x + (HTAPS_MAX/2-2)*64];
- int a2= tmpI[x + (HTAPS_MAX/2-1)*64];
- int a3= tmpI[x + (HTAPS_MAX/2+0)*64];
- int a4= tmpI[x + (HTAPS_MAX/2+1)*64];
- int a5= tmpI[x + (HTAPS_MAX/2+2)*64];
- int a6= tmpI[x + (HTAPS_MAX/2+3)*64];
- int am=0;
- if(!p || p->fast_mc)
- am= (20*(a2+a3) - 5*(a1+a4) + (a0+a5) + 512)>>10;
- else
- am= (p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) +
p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6) + 2048)>>12;
- if(am&(~255)) am= ~(am>>31);
- tmp2[x]= am;
- }
- tmpI+= 64;
- tmp2+= stride;
- }
- }
-
- hpel[ 0]= src;
- hpel[ 1]= tmp2t[0] + stride*(HTAPS_MAX/2-1);
- hpel[ 2]= src + 1;
-
- hpel[ 4]= tmp2t[1];
- hpel[ 5]= tmp2t[2];
- hpel[ 6]= tmp2t[1] + 1;
-
- hpel[ 8]= src + stride;
- hpel[ 9]= hpel[1] + stride;
- hpel[10]= hpel[8] + 1;
-
- if(b==15){
- const uint8_t *src1= hpel[dx/8 + dy/8*4 ];
- const uint8_t *src2= hpel[dx/8 + dy/8*4+1];
- const uint8_t *src3= hpel[dx/8 + dy/8*4+4];
- const uint8_t *src4= hpel[dx/8 + dy/8*4+5];
- dx&=7;
- dy&=7;
- for(y=0; y < b_h; y++){
- for(x=0; x < b_w; x++){
- dst[x]= ((8-dx)*(8-dy)*src1[x] + dx*(8-dy)*src2[x]+
- (8-dx)* dy *src3[x] + dx* dy *src4[x]+32)>>6;
- }
- src1+=stride;
- src2+=stride;
- src3+=stride;
- src4+=stride;
- dst +=stride;
- }
- }else{
- const uint8_t *src1= hpel[l];
- const uint8_t *src2= hpel[r];
- int a= weight[((dx&7) + (8*(dy&7)))];
- int b= 8-a;
- for(y=0; y < b_h; y++){
- for(x=0; x < b_w; x++){
- dst[x]= (a*src1[x] + b*src2[x] + 4)>>3;
- }
- src1+=stride;
- src2+=stride;
- dst +=stride;
- }
- }
-}
-
-#define mca(dx,dy,b_w)\
-static void mc_block_hpel ## dx ## dy ## b_w(uint8_t *dst, const uint8_t *src,
int stride, int h){\
- assert(h==b_w);\
- mc_block(NULL, dst, src-(HTAPS_MAX/2-1)-(HTAPS_MAX/2-1)*stride, stride,
b_w, b_w, dx, dy);\
-}
-
-mca( 0, 0,16)
-mca( 8, 0,16)
-mca( 0, 8,16)
-mca( 8, 8,16)
-mca( 0, 0,8)
-mca( 8, 0,8)
-mca( 0, 8,8)
-mca( 8, 8,8)
-
-static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride,
int sx, int sy, int b_w, int b_h, BlockNode *block, int plane_index, int w, int
h){
- if(block->type & BLOCK_INTRA){
- int x, y;
- const int color = block->color[plane_index];
- const int color4= color*0x01010101;
- if(b_w==32){
- for(y=0; y < b_h; y++){
- *(uint32_t*)&dst[0 + y*stride]= color4;
- *(uint32_t*)&dst[4 + y*stride]= color4;
- *(uint32_t*)&dst[8 + y*stride]= color4;
- *(uint32_t*)&dst[12+ y*stride]= color4;
- *(uint32_t*)&dst[16+ y*stride]= color4;
- *(uint32_t*)&dst[20+ y*stride]= color4;
- *(uint32_t*)&dst[24+ y*stride]= color4;
- *(uint32_t*)&dst[28+ y*stride]= color4;
- }
- }else if(b_w==16){
- for(y=0; y < b_h; y++){
- *(uint32_t*)&dst[0 + y*stride]= color4;
- *(uint32_t*)&dst[4 + y*stride]= color4;
- *(uint32_t*)&dst[8 + y*stride]= color4;
- *(uint32_t*)&dst[12+ y*stride]= color4;
- }
- }else if(b_w==8){
- for(y=0; y < b_h; y++){
- *(uint32_t*)&dst[0 + y*stride]= color4;
- *(uint32_t*)&dst[4 + y*stride]= color4;
- }
- }else if(b_w==4){
- for(y=0; y < b_h; y++){
- *(uint32_t*)&dst[0 + y*stride]= color4;
- }
- }else{
- for(y=0; y < b_h; y++){
- for(x=0; x < b_w; x++){
- dst[x + y*stride]= color;
- }
- }
- }
- }else{
- uint8_t *src= s->last_picture[block->ref].data[plane_index];
- const int scale= plane_index ? s->mv_scale : 2*s->mv_scale;
- int mx= block->mx*scale;
- int my= block->my*scale;
- const int dx= mx&15;
- const int dy= my&15;
- const int tab_index= 3 - (b_w>>2) + (b_w>>4);
- sx += (mx>>4) - (HTAPS_MAX/2-1);
- sy += (my>>4) - (HTAPS_MAX/2-1);
- src += sx + sy*stride;
- if( (unsigned)sx >= w - b_w - (HTAPS_MAX-2)
- || (unsigned)sy >= h - b_h - (HTAPS_MAX-2)){
- s->dsp.emulated_edge_mc(tmp + MB_SIZE, src, stride,
b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h);
- src= tmp + MB_SIZE;
- }
-// assert(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h);
-// assert(!(b_w&(b_w-1)));
- assert(b_w>1 && b_h>1);
- assert((tab_index>=0 && tab_index<4) || b_w==32);
- if((dx&3) || (dy&3) || !(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h)
|| (b_w&(b_w-1)) || !s->plane[plane_index].fast_mc )
- mc_block(&s->plane[plane_index], dst, src, stride, b_w, b_h, dx,
dy);
- else if(b_w==32){
- int y;
- for(y=0; y<b_h; y+=16){
- s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + y*stride,
src + 3 + (y+3)*stride,stride);
- s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + 16 +
y*stride, src + 19 + (y+3)*stride,stride);
- }
- }else if(b_w==b_h)
- s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst,src +
3 + 3*stride,stride);
- else if(b_w==2*b_h){
- s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst
,src + 3 + 3*stride,stride);
-
s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst+b_h,src + 3 + b_h
+ 3*stride,stride);
- }else{
- assert(2*b_w==b_h);
- s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst
,src + 3 + 3*stride ,stride);
- s->dsp.put_h264_qpel_pixels_tab[tab_index
][dy+(dx>>2)](dst+b_w*stride,src + 3 + 3*stride+b_w*stride,stride);
- }
- }
-}
-
//FIXME name cleanup (b_w, block_w, b_width stuff)
static av_always_inline void add_yblock(SnowContext *s, int sliced,
slice_buffer *sb, IDWTELEM *dst, uint8_t *dst8, const uint8_t *obmc, int src_x,
int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int
obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index){
const int b_width = s->b_width << s->block_max_depth;
@@ -654,14 +352,14 @@ static av_always_inline void add_yblock(SnowContext *s,
int sliced, slice_buffer
ptmp= tmp + 3*tmp_step;
block[0]= ptmp;
ptmp+=tmp_step;
- pred_block(s, block[0], tmp, src_stride, src_x, src_y, b_w, b_h, lt,
plane_index, w, h);
+ snow_pred_block(s, block[0], tmp, src_stride, src_x, src_y, b_w, b_h, lt,
plane_index, w, h);
if(same_block(lt, rt)){
block[1]= block[0];
}else{
block[1]= ptmp;
ptmp+=tmp_step;
- pred_block(s, block[1], tmp, src_stride, src_x, src_y, b_w, b_h, rt,
plane_index, w, h);
+ snow_pred_block(s, block[1], tmp, src_stride, src_x, src_y, b_w, b_h,
rt, plane_index, w, h);
}
if(same_block(lt, lb)){
@@ -671,7 +369,7 @@ static av_always_inline void add_yblock(SnowContext *s, int
sliced, slice_buffer
}else{
block[2]= ptmp;
ptmp+=tmp_step;
- pred_block(s, block[2], tmp, src_stride, src_x, src_y, b_w, b_h, lb,
plane_index, w, h);
+ snow_pred_block(s, block[2], tmp, src_stride, src_x, src_y, b_w, b_h,
lb, plane_index, w, h);
}
if(same_block(lt, rb) ){
@@ -682,7 +380,7 @@ static av_always_inline void add_yblock(SnowContext *s, int
sliced, slice_buffer
block[3]= block[2];
}else{
block[3]= ptmp;
- pred_block(s, block[3], tmp, src_stride, src_x, src_y, b_w, b_h, rb,
plane_index, w, h);
+ snow_pred_block(s, block[3], tmp, src_stride, src_x, src_y, b_w, b_h,
rb, plane_index, w, h);
}
if(sliced){
s->dwt.inner_add_yblock(obmc, obmc_stride, block, b_w, b_h,
src_x,src_y, src_stride, sb, add, dst8);
@@ -1078,86 +776,6 @@ static int decode_header(SnowContext *s){
return 0;
}
-static void init_qexp(void){
- int i;
- double v=128;
-
- for(i=0; i<QROOT; i++){
- qexp[i]= lrintf(v);
- v *= pow(2, 1.0 / QROOT);
- }
-}
-
-static av_cold int common_init(AVCodecContext *avctx){
- SnowContext *s = avctx->priv_data;
- int width, height;
- int i, j;
-
- s->avctx= avctx;
- s->max_ref_frames=1; //just make sure its not an invalid value in case of
no initial keyframe
-
- dsputil_init(&s->dsp, avctx);
- ff_dwt_init(&s->dwt);
-
-#define mcf(dx,dy)\
- s->dsp.put_qpel_pixels_tab [0][dy+dx/4]=\
- s->dsp.put_no_rnd_qpel_pixels_tab[0][dy+dx/4]=\
- s->dsp.put_h264_qpel_pixels_tab[0][dy+dx/4];\
- s->dsp.put_qpel_pixels_tab [1][dy+dx/4]=\
- s->dsp.put_no_rnd_qpel_pixels_tab[1][dy+dx/4]=\
- s->dsp.put_h264_qpel_pixels_tab[1][dy+dx/4];
-
- mcf( 0, 0)
- mcf( 4, 0)
- mcf( 8, 0)
- mcf(12, 0)
- mcf( 0, 4)
- mcf( 4, 4)
- mcf( 8, 4)
- mcf(12, 4)
- mcf( 0, 8)
- mcf( 4, 8)
- mcf( 8, 8)
- mcf(12, 8)
- mcf( 0,12)
- mcf( 4,12)
- mcf( 8,12)
- mcf(12,12)
-
-#define mcfh(dx,dy)\
- s->dsp.put_pixels_tab [0][dy/4+dx/8]=\
- s->dsp.put_no_rnd_pixels_tab[0][dy/4+dx/8]=\
- mc_block_hpel ## dx ## dy ## 16;\
- s->dsp.put_pixels_tab [1][dy/4+dx/8]=\
- s->dsp.put_no_rnd_pixels_tab[1][dy/4+dx/8]=\
- mc_block_hpel ## dx ## dy ## 8;
-
- mcfh(0, 0)
- mcfh(8, 0)
- mcfh(0, 8)
- mcfh(8, 8)
-
- if(!qexp[0])
- init_qexp();
-
-// dec += FFMAX(s->chroma_h_shift, s->chroma_v_shift);
-
- width= s->avctx->width;
- height= s->avctx->height;
-
- s->spatial_idwt_buffer= av_mallocz(width*height*sizeof(IDWTELEM));
- s->spatial_dwt_buffer= av_mallocz(width*height*sizeof(DWTELEM)); //FIXME
this does not belong here
-
- for(i=0; i<MAX_REF_FRAMES; i++)
- for(j=0; j<MAX_REF_FRAMES; j++)
- scale_mv_ref[i][j] = 256*(i+1)/(j+1);
-
- s->avctx->get_buffer(s->avctx, &s->mconly_picture);
- s->scratchbuf = av_malloc(s->mconly_picture.linesize[0]*7*MB_SIZE);
-
- return 0;
-}
-
static int common_init_after_header(AVCodecContext *avctx){
SnowContext *s = avctx->priv_data;
int plane_index, level, orientation;
@@ -1257,75 +875,6 @@ static void dequantize_all(SnowContext *s, Plane *p,
IDWTELEM *buffer, int width
}
}
-static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width,
int height, int stride, int type){
- int level, orientation, ys, xs, x, y, pass;
- IDWTELEM best_dequant[height * stride];
- IDWTELEM idwt2_buffer[height * stride];
- const int score_stride= (width + 10)/Q2_STEP;
- int best_score[(width + 10)/Q2_STEP * (height + 10)/Q2_STEP]; //FIXME size
- int score[(width + 10)/Q2_STEP * (height + 10)/Q2_STEP]; //FIXME size
- int threshold= (s->m.lambda * s->m.lambda) >> 6;
-
- //FIXME pass the copy cleanly ?
-
-// memcpy(dwt_buffer, buffer, height * stride * sizeof(DWTELEM));
- ff_spatial_dwt(buffer, width, height, stride, type,
s->spatial_decomposition_count);
-
- for(level=0; level<s->spatial_decomposition_count; level++){
- for(orientation=level ? 1 : 0; orientation<4; orientation++){
- SubBand *b= &p->band[level][orientation];
- IDWTELEM *dst= best_dequant + (b->ibuf - s->spatial_idwt_buffer);
- DWTELEM *src= buffer + (b-> buf - s->spatial_dwt_buffer);
- assert(src == b->buf); // code does not depend on this but it is
true currently
-
- quantize(s, b, dst, src, b->stride, s->qbias);
- }
- }
- for(pass=0; pass<1; pass++){
- if(s->qbias == 0) //keyframe
- continue;
- for(level=0; level<s->spatial_decomposition_count; level++){
- for(orientation=level ? 1 : 0; orientation<4; orientation++){
- SubBand *b= &p->band[level][orientation];
- IDWTELEM *dst= idwt2_buffer + (b->ibuf -
s->spatial_idwt_buffer);
- IDWTELEM *best_dst= best_dequant + (b->ibuf -
s->spatial_idwt_buffer);
-
- for(ys= 0; ys<Q2_STEP; ys++){
- for(xs= 0; xs<Q2_STEP; xs++){
- memcpy(idwt2_buffer, best_dequant, height * stride *
sizeof(IDWTELEM));
- dequantize_all(s, p, idwt2_buffer, width, height);
- ff_spatial_idwt(idwt2_buffer, width, height, stride,
type, s->spatial_decomposition_count);
- find_sse(s, p, best_score, score_stride, idwt2_buffer,
s->spatial_idwt_buffer, level, orientation);
- memcpy(idwt2_buffer, best_dequant, height * stride *
sizeof(IDWTELEM));
- for(y=ys; y<b->height; y+= Q2_STEP){
- for(x=xs; x<b->width; x+= Q2_STEP){
- if(dst[x + y*b->stride]<0) dst[x +
y*b->stride]++;
- if(dst[x + y*b->stride]>0) dst[x +
y*b->stride]--;
- //FIXME try more than just --
- }
- }
- dequantize_all(s, p, idwt2_buffer, width, height);
- ff_spatial_idwt(idwt2_buffer, width, height, stride,
type, s->spatial_decomposition_count);
- find_sse(s, p, score, score_stride, idwt2_buffer,
s->spatial_idwt_buffer, level, orientation);
- for(y=ys; y<b->height; y+= Q2_STEP){
- for(x=xs; x<b->width; x+= Q2_STEP){
- int score_idx= x/Q2_STEP +
(y/Q2_STEP)*score_stride;
- if(score[score_idx] <= best_score[score_idx] +
threshold){
- best_score[score_idx]= score[score_idx];
- if(best_dst[x + y*b->stride]<0) best_dst[x
+ y*b->stride]++;
- if(best_dst[x + y*b->stride]>0) best_dst[x
+ y*b->stride]--;
- //FIXME copy instead
- }
- }
- }
- }
- }
- }
- }
- }
- memcpy(s->spatial_idwt_buffer, best_dequant, height * stride *
sizeof(IDWTELEM)); //FIXME work with that directly instead of copy at the end
-}
-
#endif /* QUANTIZE2==1 */
#define USE_HALFPEL_PLANE 0
@@ -1477,7 +1026,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
{
avctx->pix_fmt= PIX_FMT_YUV420P;
- common_init(avctx);
+ snow_common_init(avctx);
return 0;
}
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index dfa8631..cdf0038 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -54,14 +54,7 @@ static const int8_t quant3bA[256]={
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
};
-static int scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
-
-#ifdef __sgi
-// Avoid a name clash on SGI IRIX
-#undef qexp
-#endif
#define QEXPSHIFT (7-FRAC_BITS+8) //FIXME try to change this to 0
-static uint8_t qexp[QROOT];
static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int
is_signed){
int i;
@@ -290,22 +283,6 @@ static inline void init_ref(MotionEstContext *c, uint8_t
*src[3], uint8_t *ref[3
assert(!ref_index);
}
-static inline void pred_mv(SnowContext *s, int *mx, int *my, int ref,
- const BlockNode *left, const BlockNode *top, const
BlockNode *tr){
- if(s->ref_frames == 1){
- *mx = mid_pred(left->mx, top->mx, tr->mx);
- *my = mid_pred(left->my, top->my, tr->my);
- }else{
- const int *scale = scale_mv_ref[ref];
- *mx = mid_pred((left->mx * scale[left->ref] + 128) >>8,
- (top ->mx * scale[top ->ref] + 128) >>8,
- (tr ->mx * scale[tr ->ref] + 128) >>8);
- *my = mid_pred((left->my * scale[left->ref] + 128) >>8,
- (top ->my * scale[top ->ref] + 128) >>8,
- (tr ->my * scale[tr ->ref] + 128) >>8);
- }
-}
-
static av_always_inline int same_block(BlockNode *a, BlockNode *b){
if((a->type&BLOCK_INTRA) && (b->type&BLOCK_INTRA)){
return !((a->color[0] - b->color[0]) | (a->color[1] - b->color[1]) |
(a->color[2] - b->color[2]));
@@ -314,285 +291,6 @@ static av_always_inline int same_block(BlockNode *a,
BlockNode *b){
}
}
-static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, int stride,
int b_w, int b_h, int dx, int dy){
- static const uint8_t weight[64]={
- 8,7,6,5,4,3,2,1,
- 7,7,0,0,0,0,0,1,
- 6,0,6,0,0,0,2,0,
- 5,0,0,5,0,3,0,0,
- 4,0,0,0,4,0,0,0,
- 3,0,0,5,0,3,0,0,
- 2,0,6,0,0,0,2,0,
- 1,7,0,0,0,0,0,1,
- };
-
- static const uint8_t brane[256]={
-
0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
-
0x04,0x05,0xcc,0xcc,0xcc,0xcc,0xcc,0x41,0x15,0x16,0xcc,0xcc,0xcc,0xcc,0xcc,0x52,
-
0x04,0xcc,0x05,0xcc,0xcc,0xcc,0x41,0xcc,0x15,0xcc,0x16,0xcc,0xcc,0xcc,0x52,0xcc,
-
0x04,0xcc,0xcc,0x05,0xcc,0x41,0xcc,0xcc,0x15,0xcc,0xcc,0x16,0xcc,0x52,0xcc,0xcc,
-
0x04,0xcc,0xcc,0xcc,0x41,0xcc,0xcc,0xcc,0x15,0xcc,0xcc,0xcc,0x16,0xcc,0xcc,0xcc,
-
0x04,0xcc,0xcc,0x41,0xcc,0x05,0xcc,0xcc,0x15,0xcc,0xcc,0x52,0xcc,0x16,0xcc,0xcc,
-
0x04,0xcc,0x41,0xcc,0xcc,0xcc,0x05,0xcc,0x15,0xcc,0x52,0xcc,0xcc,0xcc,0x16,0xcc,
-
0x04,0x41,0xcc,0xcc,0xcc,0xcc,0xcc,0x05,0x15,0x52,0xcc,0xcc,0xcc,0xcc,0xcc,0x16,
-
0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x56,
-
0x48,0x49,0xcc,0xcc,0xcc,0xcc,0xcc,0x85,0x59,0x5A,0xcc,0xcc,0xcc,0xcc,0xcc,0x96,
-
0x48,0xcc,0x49,0xcc,0xcc,0xcc,0x85,0xcc,0x59,0xcc,0x5A,0xcc,0xcc,0xcc,0x96,0xcc,
-
0x48,0xcc,0xcc,0x49,0xcc,0x85,0xcc,0xcc,0x59,0xcc,0xcc,0x5A,0xcc,0x96,0xcc,0xcc,
-
0x48,0xcc,0xcc,0xcc,0x49,0xcc,0xcc,0xcc,0x59,0xcc,0xcc,0xcc,0x96,0xcc,0xcc,0xcc,
-
0x48,0xcc,0xcc,0x85,0xcc,0x49,0xcc,0xcc,0x59,0xcc,0xcc,0x96,0xcc,0x5A,0xcc,0xcc,
-
0x48,0xcc,0x85,0xcc,0xcc,0xcc,0x49,0xcc,0x59,0xcc,0x96,0xcc,0xcc,0xcc,0x5A,0xcc,
-
0x48,0x85,0xcc,0xcc,0xcc,0xcc,0xcc,0x49,0x59,0x96,0xcc,0xcc,0xcc,0xcc,0xcc,0x5A,
- };
-
- static const uint8_t needs[16]={
- 0,1,0,0,
- 2,4,2,0,
- 0,1,0,0,
- 15
- };
-
- int x, y, b, r, l;
- int16_t tmpIt [64*(32+HTAPS_MAX)];
- uint8_t tmp2t[3][stride*(32+HTAPS_MAX)];
- int16_t *tmpI= tmpIt;
- uint8_t *tmp2= tmp2t[0];
- const uint8_t *hpel[11];
- assert(dx<16 && dy<16);
- r= brane[dx + 16*dy]&15;
- l= brane[dx + 16*dy]>>4;
-
- b= needs[l] | needs[r];
- if(p && !p->diag_mc)
- b= 15;
-
- if(b&5){
- for(y=0; y < b_h+HTAPS_MAX-1; y++){
- for(x=0; x < b_w; x++){
- int a_1=src[x + HTAPS_MAX/2-4];
- int a0= src[x + HTAPS_MAX/2-3];
- int a1= src[x + HTAPS_MAX/2-2];
- int a2= src[x + HTAPS_MAX/2-1];
- int a3= src[x + HTAPS_MAX/2+0];
- int a4= src[x + HTAPS_MAX/2+1];
- int a5= src[x + HTAPS_MAX/2+2];
- int a6= src[x + HTAPS_MAX/2+3];
- int am=0;
- if(!p || p->fast_mc){
- am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5);
- tmpI[x]= am;
- am= (am+16)>>5;
- }else{
- am= p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) +
p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6);
- tmpI[x]= am;
- am= (am+32)>>6;
- }
-
- if(am&(~255)) am= ~(am>>31);
- tmp2[x]= am;
- }
- tmpI+= 64;
- tmp2+= stride;
- src += stride;
- }
- src -= stride*y;
- }
- src += HTAPS_MAX/2 - 1;
- tmp2= tmp2t[1];
-
- if(b&2){
- for(y=0; y < b_h; y++){
- for(x=0; x < b_w+1; x++){
- int a_1=src[x + (HTAPS_MAX/2-4)*stride];
- int a0= src[x + (HTAPS_MAX/2-3)*stride];
- int a1= src[x + (HTAPS_MAX/2-2)*stride];
- int a2= src[x + (HTAPS_MAX/2-1)*stride];
- int a3= src[x + (HTAPS_MAX/2+0)*stride];
- int a4= src[x + (HTAPS_MAX/2+1)*stride];
- int a5= src[x + (HTAPS_MAX/2+2)*stride];
- int a6= src[x + (HTAPS_MAX/2+3)*stride];
- int am=0;
- if(!p || p->fast_mc)
- am= (20*(a2+a3) - 5*(a1+a4) + (a0+a5) + 16)>>5;
- else
- am= (p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) +
p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6) + 32)>>6;
-
- if(am&(~255)) am= ~(am>>31);
- tmp2[x]= am;
- }
- src += stride;
- tmp2+= stride;
- }
- src -= stride*y;
- }
- src += stride*(HTAPS_MAX/2 - 1);
- tmp2= tmp2t[2];
- tmpI= tmpIt;
- if(b&4){
- for(y=0; y < b_h; y++){
- for(x=0; x < b_w; x++){
- int a_1=tmpI[x + (HTAPS_MAX/2-4)*64];
- int a0= tmpI[x + (HTAPS_MAX/2-3)*64];
- int a1= tmpI[x + (HTAPS_MAX/2-2)*64];
- int a2= tmpI[x + (HTAPS_MAX/2-1)*64];
- int a3= tmpI[x + (HTAPS_MAX/2+0)*64];
- int a4= tmpI[x + (HTAPS_MAX/2+1)*64];
- int a5= tmpI[x + (HTAPS_MAX/2+2)*64];
- int a6= tmpI[x + (HTAPS_MAX/2+3)*64];
- int am=0;
- if(!p || p->fast_mc)
- am= (20*(a2+a3) - 5*(a1+a4) + (a0+a5) + 512)>>10;
- else
- am= (p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) +
p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6) + 2048)>>12;
- if(am&(~255)) am= ~(am>>31);
- tmp2[x]= am;
- }
- tmpI+= 64;
- tmp2+= stride;
- }
- }
-
- hpel[ 0]= src;
- hpel[ 1]= tmp2t[0] + stride*(HTAPS_MAX/2-1);
- hpel[ 2]= src + 1;
-
- hpel[ 4]= tmp2t[1];
- hpel[ 5]= tmp2t[2];
- hpel[ 6]= tmp2t[1] + 1;
-
- hpel[ 8]= src + stride;
- hpel[ 9]= hpel[1] + stride;
- hpel[10]= hpel[8] + 1;
-
- if(b==15){
- const uint8_t *src1= hpel[dx/8 + dy/8*4 ];
- const uint8_t *src2= hpel[dx/8 + dy/8*4+1];
- const uint8_t *src3= hpel[dx/8 + dy/8*4+4];
- const uint8_t *src4= hpel[dx/8 + dy/8*4+5];
- dx&=7;
- dy&=7;
- for(y=0; y < b_h; y++){
- for(x=0; x < b_w; x++){
- dst[x]= ((8-dx)*(8-dy)*src1[x] + dx*(8-dy)*src2[x]+
- (8-dx)* dy *src3[x] + dx* dy *src4[x]+32)>>6;
- }
- src1+=stride;
- src2+=stride;
- src3+=stride;
- src4+=stride;
- dst +=stride;
- }
- }else{
- const uint8_t *src1= hpel[l];
- const uint8_t *src2= hpel[r];
- int a= weight[((dx&7) + (8*(dy&7)))];
- int b= 8-a;
- for(y=0; y < b_h; y++){
- for(x=0; x < b_w; x++){
- dst[x]= (a*src1[x] + b*src2[x] + 4)>>3;
- }
- src1+=stride;
- src2+=stride;
- dst +=stride;
- }
- }
-}
-
-#define mca(dx,dy,b_w)\
-static void mc_block_hpel ## dx ## dy ## b_w(uint8_t *dst, const uint8_t *src,
int stride, int h){\
- assert(h==b_w);\
- mc_block(NULL, dst, src-(HTAPS_MAX/2-1)-(HTAPS_MAX/2-1)*stride, stride,
b_w, b_w, dx, dy);\
-}
-
-mca( 0, 0,16)
-mca( 8, 0,16)
-mca( 0, 8,16)
-mca( 8, 8,16)
-mca( 0, 0,8)
-mca( 8, 0,8)
-mca( 0, 8,8)
-mca( 8, 8,8)
-
-static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride,
int sx, int sy, int b_w, int b_h, BlockNode *block, int plane_index, int w, int
h){
- if(block->type & BLOCK_INTRA){
- int x, y;
- const int color = block->color[plane_index];
- const int color4= color*0x01010101;
- if(b_w==32){
- for(y=0; y < b_h; y++){
- *(uint32_t*)&dst[0 + y*stride]= color4;
- *(uint32_t*)&dst[4 + y*stride]= color4;
- *(uint32_t*)&dst[8 + y*stride]= color4;
- *(uint32_t*)&dst[12+ y*stride]= color4;
- *(uint32_t*)&dst[16+ y*stride]= color4;
- *(uint32_t*)&dst[20+ y*stride]= color4;
- *(uint32_t*)&dst[24+ y*stride]= color4;
- *(uint32_t*)&dst[28+ y*stride]= color4;
- }
- }else if(b_w==16){
- for(y=0; y < b_h; y++){
- *(uint32_t*)&dst[0 + y*stride]= color4;
- *(uint32_t*)&dst[4 + y*stride]= color4;
- *(uint32_t*)&dst[8 + y*stride]= color4;
- *(uint32_t*)&dst[12+ y*stride]= color4;
- }
- }else if(b_w==8){
- for(y=0; y < b_h; y++){
- *(uint32_t*)&dst[0 + y*stride]= color4;
- *(uint32_t*)&dst[4 + y*stride]= color4;
- }
- }else if(b_w==4){
- for(y=0; y < b_h; y++){
- *(uint32_t*)&dst[0 + y*stride]= color4;
- }
- }else{
- for(y=0; y < b_h; y++){
- for(x=0; x < b_w; x++){
- dst[x + y*stride]= color;
- }
- }
- }
- }else{
- uint8_t *src= s->last_picture[block->ref].data[plane_index];
- const int scale= plane_index ? s->mv_scale : 2*s->mv_scale;
- int mx= block->mx*scale;
- int my= block->my*scale;
- const int dx= mx&15;
- const int dy= my&15;
- const int tab_index= 3 - (b_w>>2) + (b_w>>4);
- sx += (mx>>4) - (HTAPS_MAX/2-1);
- sy += (my>>4) - (HTAPS_MAX/2-1);
- src += sx + sy*stride;
- if( (unsigned)sx >= w - b_w - (HTAPS_MAX-2)
- || (unsigned)sy >= h - b_h - (HTAPS_MAX-2)){
- s->dsp.emulated_edge_mc(tmp + MB_SIZE, src, stride,
b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h);
- src= tmp + MB_SIZE;
- }
-// assert(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h);
-// assert(!(b_w&(b_w-1)));
- assert(b_w>1 && b_h>1);
- assert((tab_index>=0 && tab_index<4) || b_w==32);
- if((dx&3) || (dy&3) || !(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h)
|| (b_w&(b_w-1)) || !s->plane[plane_index].fast_mc )
- mc_block(&s->plane[plane_index], dst, src, stride, b_w, b_h, dx,
dy);
- else if(b_w==32){
- int y;
- for(y=0; y<b_h; y+=16){
- s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + y*stride,
src + 3 + (y+3)*stride,stride);
- s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + 16 +
y*stride, src + 19 + (y+3)*stride,stride);
- }
- }else if(b_w==b_h)
- s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst,src +
3 + 3*stride,stride);
- else if(b_w==2*b_h){
- s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst
,src + 3 + 3*stride,stride);
-
s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst+b_h,src + 3 + b_h
+ 3*stride,stride);
- }else{
- assert(2*b_w==b_h);
- s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst
,src + 3 + 3*stride ,stride);
- s->dsp.put_h264_qpel_pixels_tab[tab_index
][dy+(dx>>2)](dst+b_w*stride,src + 3 + 3*stride+b_w*stride,stride);
- }
- }
-}
-
//FIXME name cleanup (b_w, block_w, b_width stuff)
static av_always_inline void add_yblock(SnowContext *s, int sliced,
slice_buffer *sb, IDWTELEM *dst, uint8_t *dst8, const uint8_t *obmc, int src_x,
int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int
obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index){
const int b_width = s->b_width << s->block_max_depth;
@@ -654,14 +352,14 @@ static av_always_inline void add_yblock(SnowContext *s,
int sliced, slice_buffer
ptmp= tmp + 3*tmp_step;
block[0]= ptmp;
ptmp+=tmp_step;
- pred_block(s, block[0], tmp, src_stride, src_x, src_y, b_w, b_h, lt,
plane_index, w, h);
+ snow_pred_block(s, block[0], tmp, src_stride, src_x, src_y, b_w, b_h, lt,
plane_index, w, h);
if(same_block(lt, rt)){
block[1]= block[0];
}else{
block[1]= ptmp;
ptmp+=tmp_step;
- pred_block(s, block[1], tmp, src_stride, src_x, src_y, b_w, b_h, rt,
plane_index, w, h);
+ snow_pred_block(s, block[1], tmp, src_stride, src_x, src_y, b_w, b_h,
rt, plane_index, w, h);
}
if(same_block(lt, lb)){
@@ -671,7 +369,7 @@ static av_always_inline void add_yblock(SnowContext *s, int
sliced, slice_buffer
}else{
block[2]= ptmp;
ptmp+=tmp_step;
- pred_block(s, block[2], tmp, src_stride, src_x, src_y, b_w, b_h, lb,
plane_index, w, h);
+ snow_pred_block(s, block[2], tmp, src_stride, src_x, src_y, b_w, b_h,
lb, plane_index, w, h);
}
if(same_block(lt, rb) ){
@@ -682,7 +380,7 @@ static av_always_inline void add_yblock(SnowContext *s, int
sliced, slice_buffer
block[3]= block[2];
}else{
block[3]= ptmp;
- pred_block(s, block[3], tmp, src_stride, src_x, src_y, b_w, b_h, rb,
plane_index, w, h);
+ snow_pred_block(s, block[3], tmp, src_stride, src_x, src_y, b_w, b_h,
rb, plane_index, w, h);
}
if(sliced){
s->dwt.inner_add_yblock(obmc, obmc_stride, block, b_w, b_h,
src_x,src_y, src_stride, sb, add, dst8);
@@ -829,86 +527,6 @@ static av_always_inline void predict_plane(SnowContext *s,
IDWTELEM *buf, int pl
predict_slice(s, buf, plane_index, add, mb_y);
}
-static void init_qexp(void){
- int i;
- double v=128;
-
- for(i=0; i<QROOT; i++){
- qexp[i]= lrintf(v);
- v *= pow(2, 1.0 / QROOT);
- }
-}
-
-static av_cold int common_init(AVCodecContext *avctx){
- SnowContext *s = avctx->priv_data;
- int width, height;
- int i, j;
-
- s->avctx= avctx;
- s->max_ref_frames=1; //just make sure its not an invalid value in case of
no initial keyframe
-
- dsputil_init(&s->dsp, avctx);
- ff_dwt_init(&s->dwt);
-
-#define mcf(dx,dy)\
- s->dsp.put_qpel_pixels_tab [0][dy+dx/4]=\
- s->dsp.put_no_rnd_qpel_pixels_tab[0][dy+dx/4]=\
- s->dsp.put_h264_qpel_pixels_tab[0][dy+dx/4];\
- s->dsp.put_qpel_pixels_tab [1][dy+dx/4]=\
- s->dsp.put_no_rnd_qpel_pixels_tab[1][dy+dx/4]=\
- s->dsp.put_h264_qpel_pixels_tab[1][dy+dx/4];
-
- mcf( 0, 0)
- mcf( 4, 0)
- mcf( 8, 0)
- mcf(12, 0)
- mcf( 0, 4)
- mcf( 4, 4)
- mcf( 8, 4)
- mcf(12, 4)
- mcf( 0, 8)
- mcf( 4, 8)
- mcf( 8, 8)
- mcf(12, 8)
- mcf( 0,12)
- mcf( 4,12)
- mcf( 8,12)
- mcf(12,12)
-
-#define mcfh(dx,dy)\
- s->dsp.put_pixels_tab [0][dy/4+dx/8]=\
- s->dsp.put_no_rnd_pixels_tab[0][dy/4+dx/8]=\
- mc_block_hpel ## dx ## dy ## 16;\
- s->dsp.put_pixels_tab [1][dy/4+dx/8]=\
- s->dsp.put_no_rnd_pixels_tab[1][dy/4+dx/8]=\
- mc_block_hpel ## dx ## dy ## 8;
-
- mcfh(0, 0)
- mcfh(8, 0)
- mcfh(0, 8)
- mcfh(8, 8)
-
- if(!qexp[0])
- init_qexp();
-
-// dec += FFMAX(s->chroma_h_shift, s->chroma_v_shift);
-
- width= s->avctx->width;
- height= s->avctx->height;
-
- s->spatial_idwt_buffer= av_mallocz(width*height*sizeof(IDWTELEM));
- s->spatial_dwt_buffer= av_mallocz(width*height*sizeof(DWTELEM)); //FIXME
this does not belong here
-
- for(i=0; i<MAX_REF_FRAMES; i++)
- for(j=0; j<MAX_REF_FRAMES; j++)
- scale_mv_ref[i][j] = 256*(i+1)/(j+1);
-
- s->avctx->get_buffer(s->avctx, &s->mconly_picture);
- s->scratchbuf = av_malloc(s->mconly_picture.linesize[0]*7*MB_SIZE);
-
- return 0;
-}
-
static int common_init_after_header(AVCodecContext *avctx){
SnowContext *s = avctx->priv_data;
int plane_index, level, orientation;
@@ -1257,7 +875,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->plane[plane_index].fast_mc= 1;
}
- common_init(avctx);
+ snow_common_init(avctx);
snow_alloc_blocks(s);
s->version=0;
@@ -1761,7 +1379,7 @@ static int get_block_rd(SnowContext *s, int mb_x, int
mb_y, int plane_index, con
int y1= FFMIN(block_w*2, h-sy);
int i,x,y;
- pred_block(s, cur, tmp, ref_stride, sx, sy, block_w*2, block_w*2,
&s->block[mb_x + mb_y*b_stride], plane_index, w, h);
+ snow_pred_block(s, cur, tmp, ref_stride, sx, sy, block_w*2, block_w*2,
&s->block[mb_x + mb_y*b_stride], plane_index, w, h);
for(y=y0; y<y1; y++){
const uint8_t *obmc1= obmc_edged + y*obmc_stride;
--
1.7.7
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel