diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-07-02 21:19:41 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-02 21:19:41 +0200 |
commit | b286383bd2b13fdf59aecdb23d8514323460483b (patch) | |
tree | 4f8ee9745d719e2918843d0d8ebcf053ac220ef4 /libavcodec/snowenc.c | |
parent | 7c84e7d33762a4bccc0002476a3b20e0b8f26fcc (diff) | |
parent | 5e745cefc0f89cf698c4cf0104182472fe0f603e (diff) | |
download | ffmpeg-b286383bd2b13fdf59aecdb23d8514323460483b.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
asfdec: read attached pictures.
apetag: reindent
apetag: export attached covers as video streams.
apetag: fix the amount of data read from binary tags.
apetag: make sure avio_get_str() doesn't read more than it should.
mov: read itunes cover art.
snow: remove VLA in mc_block()
intfloat: Don't use designated initializers in the public headers
snow: remove a VLA.
doc: Remind devs to check return values, especially for malloc() et al
MS ATC Screen (aka MSS3) decoder
vf_yadif: move x86 init code to x86/yadif.c
vf_gradfun: move x86 init code to x86/gradfun.c
roqvideo: Remove a totally unused dspcontext
smacker: remove some unused code
dsicin: remove dead assignment
aacdec: remove dead assignment
rl2: remove dead assignment
proresenc: make a variable local to the loop where it is used
alsdec: remove dead assignments
Conflicts:
Changelog
doc/developer.texi
libavcodec/allcodecs.c
libavcodec/avcodec.h
libavcodec/version.h
libavfilter/gradfun.h
libavfilter/x86/gradfun.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/snowenc.c')
-rw-r--r-- | libavcodec/snowenc.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index f1ebc2f87f..1a60dbf96d 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -666,7 +666,7 @@ static inline int get_block_bits(SnowContext *s, int x, int y, int w){ } } -static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, const uint8_t *obmc_edged){ +static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, uint8_t (*obmc_edged)[MB_SIZE * 2]){ Plane *p= &s->plane[plane_index]; const int block_size = MB_SIZE >> s->block_max_depth; const int block_w = plane_index ? block_size>>s->chroma_h_shift : block_size; @@ -698,7 +698,7 @@ static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, con ff_snow_pred_block(s, cur, tmp, ref_stride, sx, sy, block_w*2, block_h*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; + const uint8_t *obmc1= obmc_edged[y]; const IDWTELEM *pred1 = pred + y*obmc_stride; uint8_t *cur1 = cur + y*ref_stride; uint8_t *dst1 = dst + sx + (sy+y)*ref_stride; @@ -962,7 +962,7 @@ static int encode_subband(SnowContext *s, SubBand *b, const IDWTELEM *src, const // encode_subband_dzr(s, b, src, parent, stride, orientation); } -static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, const uint8_t *obmc_edged, int *best_rd){ +static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, uint8_t (*obmc_edged)[MB_SIZE * 2], 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= *block; @@ -1003,7 +1003,7 @@ static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int /* special case for int[2] args we discard afterwards, * fixes compilation problem with gcc 2.95 */ -static av_always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, const uint8_t *obmc_edged, int *best_rd){ +static av_always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, uint8_t (*obmc_edged)[MB_SIZE * 2], int *best_rd){ int p[2] = {p0, p1}; return check_block(s, mb_x, mb_y, p, 0, obmc_edged, best_rd); } @@ -1083,7 +1083,7 @@ static void iterative_me(SnowContext *s){ BlockNode *blb= mb_x && mb_y+1<b_height ? &s->block[index+b_stride-1] : NULL; BlockNode *brb= mb_x+1<b_width && mb_y+1<b_height ? &s->block[index+b_stride+1] : NULL; const int b_w= (MB_SIZE >> s->block_max_depth); - uint8_t obmc_edged[b_w*2][b_w*2]; + uint8_t obmc_edged[MB_SIZE * 2][MB_SIZE * 2]; if(pass && (block->type & BLOCK_OPT)) continue; @@ -1098,7 +1098,8 @@ static void iterative_me(SnowContext *s){ //FIXME precalculate { int x, y; - memcpy(obmc_edged, ff_obmc_tab[s->block_max_depth], b_w*b_w*4); + for (y = 0; y < b_w * 2; y++) + memcpy(obmc_edged[y], ff_obmc_tab[s->block_max_depth] + y * b_w * 2, b_w * 2); if(mb_x==0) for(y=0; y<b_w*2; y++) memset(obmc_edged[y], obmc_edged[y][0] + obmc_edged[y][b_w-1], b_w); @@ -1153,9 +1154,9 @@ static void iterative_me(SnowContext *s){ // get previous score (cannot be cached due to OBMC) if(pass > 0 && (block->type&BLOCK_INTRA)){ int color0[3]= {block->color[0], block->color[1], block->color[2]}; - check_block(s, mb_x, mb_y, color0, 1, *obmc_edged, &best_rd); + check_block(s, mb_x, mb_y, color0, 1, obmc_edged, &best_rd); }else - check_block_inter(s, mb_x, mb_y, block->mx, block->my, *obmc_edged, &best_rd); + check_block_inter(s, mb_x, mb_y, block->mx, block->my, obmc_edged, &best_rd); ref_b= *block; ref_rd= best_rd; @@ -1166,16 +1167,16 @@ static void iterative_me(SnowContext *s){ block->ref= ref; best_rd= INT_MAX; - check_block_inter(s, mb_x, mb_y, mvr[0][0], mvr[0][1], *obmc_edged, &best_rd); - check_block_inter(s, mb_x, mb_y, 0, 0, *obmc_edged, &best_rd); + check_block_inter(s, mb_x, mb_y, mvr[0][0], mvr[0][1], obmc_edged, &best_rd); + check_block_inter(s, mb_x, mb_y, 0, 0, obmc_edged, &best_rd); if(tb) - check_block_inter(s, mb_x, mb_y, mvr[-b_stride][0], mvr[-b_stride][1], *obmc_edged, &best_rd); + check_block_inter(s, mb_x, mb_y, mvr[-b_stride][0], mvr[-b_stride][1], obmc_edged, &best_rd); if(lb) - check_block_inter(s, mb_x, mb_y, mvr[-1][0], mvr[-1][1], *obmc_edged, &best_rd); + check_block_inter(s, mb_x, mb_y, mvr[-1][0], mvr[-1][1], obmc_edged, &best_rd); if(rb) - check_block_inter(s, mb_x, mb_y, mvr[1][0], mvr[1][1], *obmc_edged, &best_rd); + check_block_inter(s, mb_x, mb_y, mvr[1][0], mvr[1][1], obmc_edged, &best_rd); if(bb) - check_block_inter(s, mb_x, mb_y, mvr[b_stride][0], mvr[b_stride][1], *obmc_edged, &best_rd); + check_block_inter(s, mb_x, mb_y, mvr[b_stride][0], mvr[b_stride][1], obmc_edged, &best_rd); /* fullpel ME */ //FIXME avoid subpel interpolation / round to nearest integer @@ -1183,10 +1184,10 @@ static void iterative_me(SnowContext *s){ dia_change=0; for(i=0; i<FFMAX(s->avctx->dia_size, 1); i++){ for(j=0; j<i; j++){ - dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+4*(i-j), block->my+(4*j), *obmc_edged, &best_rd); - dia_change |= check_block_inter(s, mb_x, mb_y, block->mx-4*(i-j), block->my-(4*j), *obmc_edged, &best_rd); - dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+4*(i-j), block->my-(4*j), *obmc_edged, &best_rd); - dia_change |= check_block_inter(s, mb_x, mb_y, block->mx-4*(i-j), block->my+(4*j), *obmc_edged, &best_rd); + dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+4*(i-j), block->my+(4*j), obmc_edged, &best_rd); + dia_change |= check_block_inter(s, mb_x, mb_y, block->mx-4*(i-j), block->my-(4*j), obmc_edged, &best_rd); + dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+4*(i-j), block->my-(4*j), obmc_edged, &best_rd); + dia_change |= check_block_inter(s, mb_x, mb_y, block->mx-4*(i-j), block->my+(4*j), obmc_edged, &best_rd); } } }while(dia_change); @@ -1195,7 +1196,7 @@ static void iterative_me(SnowContext *s){ static const int square[8][2]= {{+1, 0},{-1, 0},{ 0,+1},{ 0,-1},{+1,+1},{-1,-1},{+1,-1},{-1,+1},}; dia_change=0; for(i=0; i<8; i++) - dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+square[i][0], block->my+square[i][1], *obmc_edged, &best_rd); + dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+square[i][0], block->my+square[i][1], obmc_edged, &best_rd); }while(dia_change); //FIXME or try the standard 2 pass qpel or similar @@ -1208,7 +1209,7 @@ static void iterative_me(SnowContext *s){ } best_rd= ref_rd; *block= ref_b; - check_block(s, mb_x, mb_y, color, 1, *obmc_edged, &best_rd); + check_block(s, mb_x, mb_y, color, 1, obmc_edged, &best_rd); //FIXME RD style color selection if(!same_block(block, &backup)){ if(tb ) tb ->type &= ~BLOCK_OPT; |