On Tue, Mar 11, 2014 at 2:42 PM, Diego Biurrun <[email protected]> wrote:
> The function is supposed to confirm that the compiler provided enough
> alignment, but in practice it is only run in certain code paths and
> insufficient alignment problems are restricted to legacy compilers.
> ---
> libavcodec/dsputil.c | 24 ------------------------
> libavcodec/dsputil.h | 2 --
> libavcodec/mpegvideo_enc.c | 6 ------
> 3 files changed, 32 deletions(-)
>
> diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
> index 6f44f9a..12f4f5c 100644
> --- a/libavcodec/dsputil.c
> +++ b/libavcodec/dsputil.c
> @@ -29,7 +29,6 @@
>
> #include "libavutil/attributes.h"
> #include "libavutil/imgutils.h"
> -#include "libavutil/internal.h"
> #include "avcodec.h"
> #include "copy_block.h"
> #include "dct.h"
> @@ -2417,30 +2416,8 @@ av_cold void ff_dsputil_static_init(void)
> }
> }
>
> -int ff_check_alignment(void){
> - static int did_fail=0;
> - LOCAL_ALIGNED_16(int, aligned, [4]);
> -
> - if((intptr_t)aligned & 15){
> - if(!did_fail){
> -#if HAVE_MMX || HAVE_ALTIVEC
> - av_log(NULL, AV_LOG_ERROR,
> - "Compiler did not align stack variables. Libavcodec has been
> miscompiled\n"
> - "and may be very slow or crash. This is not a bug in
> libavcodec,\n"
> - "but in the compiler. You may try recompiling using gcc >=
> 4.2.\n"
> - "Do not report crashes to Libav developers.\n");
> -#endif
> - did_fail=1;
> - }
> - return -1;
> - }
> - return 0;
> -}
> -
> av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx)
> {
> - ff_check_alignment();
> -
> #if CONFIG_ENCODERS
> if (avctx->bits_per_raw_sample == 10) {
> c->fdct = ff_jpeg_fdct_islow_10;
> @@ -2646,7 +2623,6 @@ av_cold void ff_dsputil_init(DSPContext* c,
> AVCodecContext *avctx)
> break;
> }
>
> -
^^ stray whitespace change.
Sorry, just had to.
> if (ARCH_ARM)
> ff_dsputil_init_arm(c, avctx);
> if (ARCH_BFIN)
> diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
> index b914fb1..46aa8aa 100644
> --- a/libavcodec/dsputil.h
> +++ b/libavcodec/dsputil.h
> @@ -293,8 +293,6 @@ typedef struct DSPContext {
> void ff_dsputil_static_init(void);
> void ff_dsputil_init(DSPContext* p, AVCodecContext *avctx);
>
> -int ff_check_alignment(void);
> -
> void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type);
>
> void ff_dsputil_init_arm(DSPContext* c, AVCodecContext *avctx);
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index 091bee3..9becaa5 100644
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -2357,8 +2357,6 @@ static int pre_estimate_motion_thread(AVCodecContext
> *c, void *arg){
> static int estimate_motion_thread(AVCodecContext *c, void *arg){
> MpegEncContext *s= *(void**)arg;
>
> - ff_check_alignment();
> -
> s->me.dia_size= s->avctx->dia_size;
> s->first_slice_line=1;
> for(s->mb_y= s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) {
> @@ -2385,8 +2383,6 @@ static int mb_var_thread(AVCodecContext *c, void *arg){
> MpegEncContext *s= *(void**)arg;
> int mb_x, mb_y;
>
> - ff_check_alignment();
> -
> for(mb_y=s->start_mb_y; mb_y < s->end_mb_y; mb_y++) {
> for(mb_x=0; mb_x < s->mb_width; mb_x++) {
> int xx = mb_x * 16;
> @@ -2477,8 +2473,6 @@ static int encode_thread(AVCodecContext *c, void *arg){
> uint8_t bit_buf_tex[2][MAX_MB_BYTES];
> PutBitContext pb[2], pb2[2], tex_pb[2];
>
> - ff_check_alignment();
> -
> for(i=0; i<2; i++){
> init_put_bits(&pb [i], bit_buf [i], MAX_MB_BYTES);
> init_put_bits(&pb2 [i], bit_buf2 [i], MAX_MB_BYTES);
> --
> 1.8.3.2
>
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel