stride align cleanup
Originally committed as revision 3640 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
@@ -426,6 +426,7 @@ static inline void emms(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define __align8 __attribute__ ((aligned (8)))
|
#define __align8 __attribute__ ((aligned (8)))
|
||||||
|
#define STRIDE_ALIGN 8
|
||||||
|
|
||||||
void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
|
void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
|
||||||
void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);
|
void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);
|
||||||
@@ -435,6 +436,7 @@ void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);
|
|||||||
/* This is to use 4 bytes read to the IDCT pointers for some 'zero'
|
/* This is to use 4 bytes read to the IDCT pointers for some 'zero'
|
||||||
line optimizations */
|
line optimizations */
|
||||||
#define __align8 __attribute__ ((aligned (4)))
|
#define __align8 __attribute__ ((aligned (4)))
|
||||||
|
#define STRIDE_ALIGN 4
|
||||||
|
|
||||||
void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx);
|
void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx);
|
||||||
|
|
||||||
@@ -442,6 +444,7 @@ void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx);
|
|||||||
|
|
||||||
/* SPARC/VIS IDCT needs 8-byte aligned DCT blocks */
|
/* SPARC/VIS IDCT needs 8-byte aligned DCT blocks */
|
||||||
#define __align8 __attribute__ ((aligned (8)))
|
#define __align8 __attribute__ ((aligned (8)))
|
||||||
|
#define STRIDE_ALIGN 8
|
||||||
|
|
||||||
void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx);
|
void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx);
|
||||||
|
|
||||||
@@ -449,11 +452,13 @@ void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx);
|
|||||||
|
|
||||||
/* SPARC/VIS IDCT needs 8-byte aligned DCT blocks */
|
/* SPARC/VIS IDCT needs 8-byte aligned DCT blocks */
|
||||||
#define __align8 __attribute__ ((aligned (8)))
|
#define __align8 __attribute__ ((aligned (8)))
|
||||||
|
#define STRIDE_ALIGN 8
|
||||||
void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
|
void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
|
||||||
|
|
||||||
#elif defined(ARCH_ALPHA)
|
#elif defined(ARCH_ALPHA)
|
||||||
|
|
||||||
#define __align8 __attribute__ ((aligned (8)))
|
#define __align8 __attribute__ ((aligned (8)))
|
||||||
|
#define STRIDE_ALIGN 8
|
||||||
|
|
||||||
void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);
|
void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);
|
||||||
|
|
||||||
@@ -470,24 +475,28 @@ extern int mm_flags;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define __align8 __attribute__ ((aligned (16)))
|
#define __align8 __attribute__ ((aligned (16)))
|
||||||
|
#define STRIDE_ALIGN 16
|
||||||
|
|
||||||
void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx);
|
void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx);
|
||||||
|
|
||||||
#elif defined(HAVE_MMI)
|
#elif defined(HAVE_MMI)
|
||||||
|
|
||||||
#define __align8 __attribute__ ((aligned (16)))
|
#define __align8 __attribute__ ((aligned (16)))
|
||||||
|
#define STRIDE_ALIGN 16
|
||||||
|
|
||||||
void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx);
|
void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx);
|
||||||
|
|
||||||
#elif defined(ARCH_SH4)
|
#elif defined(ARCH_SH4)
|
||||||
|
|
||||||
#define __align8 __attribute__ ((aligned (8)))
|
#define __align8 __attribute__ ((aligned (8)))
|
||||||
|
#define STRIDE_ALIGN 8
|
||||||
|
|
||||||
void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx);
|
void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define __align8
|
#define __align8 __attribute__ ((aligned (8)))
|
||||||
|
#define STRIDE_ALIGN 8
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -219,7 +219,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
|
|||||||
buf->last_pic_num= *picture_number;
|
buf->last_pic_num= *picture_number;
|
||||||
}else{
|
}else{
|
||||||
int h_chroma_shift, v_chroma_shift;
|
int h_chroma_shift, v_chroma_shift;
|
||||||
int s_align, pixel_size;
|
int pixel_size;
|
||||||
|
|
||||||
avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift);
|
avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift);
|
||||||
|
|
||||||
@@ -242,11 +242,6 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
|
|||||||
}
|
}
|
||||||
|
|
||||||
avcodec_align_dimensions(s, &w, &h);
|
avcodec_align_dimensions(s, &w, &h);
|
||||||
#if defined(ARCH_POWERPC) || defined(HAVE_MMI) //FIXME some cleaner check
|
|
||||||
s_align= 16;
|
|
||||||
#else
|
|
||||||
s_align= 8;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(!(s->flags&CODEC_FLAG_EMU_EDGE)){
|
if(!(s->flags&CODEC_FLAG_EMU_EDGE)){
|
||||||
w+= EDGE_WIDTH*2;
|
w+= EDGE_WIDTH*2;
|
||||||
@@ -260,7 +255,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
|
|||||||
const int v_shift= i==0 ? 0 : v_chroma_shift;
|
const int v_shift= i==0 ? 0 : v_chroma_shift;
|
||||||
|
|
||||||
//FIXME next ensures that linesize= 2^x uvlinesize, thats needed because some MC code assumes it
|
//FIXME next ensures that linesize= 2^x uvlinesize, thats needed because some MC code assumes it
|
||||||
buf->linesize[i]= ALIGN(pixel_size*w>>h_shift, s_align<<(h_chroma_shift-h_shift));
|
buf->linesize[i]= ALIGN(pixel_size*w>>h_shift, STRIDE_ALIGN<<(h_chroma_shift-h_shift));
|
||||||
|
|
||||||
buf->base[i]= av_mallocz((buf->linesize[i]*h>>v_shift)+16); //FIXME 16
|
buf->base[i]= av_mallocz((buf->linesize[i]*h>>v_shift)+16); //FIXME 16
|
||||||
if(buf->base[i]==NULL) return -1;
|
if(buf->base[i]==NULL) return -1;
|
||||||
@@ -269,7 +264,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
|
|||||||
if(s->flags&CODEC_FLAG_EMU_EDGE)
|
if(s->flags&CODEC_FLAG_EMU_EDGE)
|
||||||
buf->data[i] = buf->base[i];
|
buf->data[i] = buf->base[i];
|
||||||
else
|
else
|
||||||
buf->data[i] = buf->base[i] + ALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), s_align);
|
buf->data[i] = buf->base[i] + ALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), STRIDE_ALIGN);
|
||||||
}
|
}
|
||||||
pic->age= 256*256*256*64;
|
pic->age= 256*256*256*64;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user