From 5ab432fa3500c190184263b80c6ad04547770545 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 13 Oct 2012 02:28:41 +0100 Subject: [PATCH 1/4] configure: improve tms470 compiler usage with glibc Apply flags to work around glibc quirks only if glibc is detected, and add a few more such flags. Do not mess with as/ld settings in probe_cc. This is not the proper place. Signed-off-by: Mans Rullgard --- configure | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 3dbacd3adb..3e299092e6 100755 --- a/configure +++ b/configure @@ -2289,11 +2289,8 @@ probe_cc(){ _type=tms470 _ident=$($_cc -version | head -n1 | tr -s ' ') _flags='--gcc --abi=eabi -me' - _cflags='-D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=' _cc_e='-ppl -fe=$@' _cc_o='-fe=$@' - as_default="${cross_prefix}gcc" - ld_default="${cross_prefix}gcc" _depflags='-ppa -ppd=$(@:.o=.d)' _cflags_speed='-O3 -mf=5' _cflags_size='-O3 -mf=2' @@ -2911,6 +2908,15 @@ fi test -n "$libc_type" && enable $libc_type +# hacks for compiler/libc/os combinations + +if enabled_all tms470 glibc; then + add_cppflags -D__USER_LABEL_PREFIX__= + add_cppflags -D__builtin_memset=memset + add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED + add_cflags -pds=48 # incompatible redefinition of macro +fi + esc(){ echo "$*" | sed 's/%/%25/g;s/:/%3a/g' } From b6f8d635f27bd1234508679c93e04f60a36c2f1e Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 13 Oct 2012 03:16:13 +0100 Subject: [PATCH 2/4] build: tms470: work around glibc math.h problems The glibc definitions of INFINITY and NAN do not work with the tms470 compiler, nor do our usual fallbacks. Signed-off-by: Mans Rullgard --- compat/tms470/math.h | 7 +++++++ configure | 1 + 2 files changed, 8 insertions(+) create mode 100644 compat/tms470/math.h diff --git a/compat/tms470/math.h b/compat/tms470/math.h new file mode 100644 index 0000000000..1104d744e7 --- /dev/null +++ b/compat/tms470/math.h @@ -0,0 +1,7 @@ +#include_next + +#undef INFINITY +#undef NAN + +#define INFINITY (*(const float*)((const unsigned []){ 0x7f800000 })) +#define NAN (*(const float*)((const unsigned []){ 0x7fc00000 })) diff --git a/configure b/configure index 3e299092e6..d8a57284c9 100755 --- a/configure +++ b/configure @@ -2911,6 +2911,7 @@ test -n "$libc_type" && enable $libc_type # hacks for compiler/libc/os combinations if enabled_all tms470 glibc; then + CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}" add_cppflags -D__USER_LABEL_PREFIX__= add_cppflags -D__builtin_memset=memset add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED From 52d113ee06ba136e530c11e651a5ae085384d49c Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 4 Oct 2012 21:15:51 +0200 Subject: [PATCH 3/4] avutil: Rename ff_set_systematic_pal2() ---> avpriv_set_systematic_pal2() Functions used across libraries should have avpriv_ and not ff_ prefixes. --- libavcodec/bmpenc.c | 2 +- libavcodec/rawdec.c | 2 +- libavcodec/utils.c | 2 +- libavutil/imgutils.c | 4 ++-- libavutil/imgutils.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/bmpenc.c b/libavcodec/bmpenc.c index a798f34409..d27282dc13 100644 --- a/libavcodec/bmpenc.c +++ b/libavcodec/bmpenc.c @@ -93,7 +93,7 @@ static int bmp_encode_frame(AVCodecContext *avctx, AVPacket *pkt, case AV_PIX_FMT_RGB4_BYTE: case AV_PIX_FMT_BGR4_BYTE: case AV_PIX_FMT_GRAY8: - ff_set_systematic_pal2((uint32_t*)p->data[1], avctx->pix_fmt); + avpriv_set_systematic_pal2((uint32_t*)p->data[1], avctx->pix_fmt); case AV_PIX_FMT_PAL8: pal = (uint32_t *)p->data[1]; break; diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 0f47e3f96d..449755f9b2 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -86,7 +86,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx) else if (avctx->pix_fmt == AV_PIX_FMT_NONE && avctx->bits_per_coded_sample) avctx->pix_fmt = find_pix_fmt(pix_fmt_bps_avi, avctx->bits_per_coded_sample); - ff_set_systematic_pal2(context->palette, avctx->pix_fmt); + avpriv_set_systematic_pal2(context->palette, avctx->pix_fmt); context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); if((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) && avctx->pix_fmt==AV_PIX_FMT_PAL8 && diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4a3ac72b6c..bb99a5a32d 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -482,7 +482,7 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic) buf->linesize[i] = 0; } if (size[1] && !size[2]) - ff_set_systematic_pal2((uint32_t *)buf->data[1], s->pix_fmt); + avpriv_set_systematic_pal2((uint32_t *)buf->data[1], s->pix_fmt); buf->width = s->width; buf->height = s->height; buf->pix_fmt = s->pix_fmt; diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c index e661e1bf8d..413329d50b 100644 --- a/libavutil/imgutils.c +++ b/libavutil/imgutils.c @@ -136,7 +136,7 @@ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei return total_size; } -int ff_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt) +int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt) { int i; @@ -204,7 +204,7 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4], return ret; } if (desc->flags & PIX_FMT_PAL || desc->flags & PIX_FMT_PSEUDOPAL) - ff_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt); + avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt); return ret; } diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h index 4f355bd232..71510132ae 100644 --- a/libavutil/imgutils.h +++ b/libavutil/imgutils.h @@ -128,7 +128,7 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], */ int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); -int ff_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt); +int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt); /** * @} From 7638f0b2fef0481e55985ab8530e8ad9c16f113a Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 4 Oct 2012 19:20:03 +0200 Subject: [PATCH 4/4] avutil: Do not make ff_ symbols globally visible. --- libavutil/libavutil.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/libavutil.v b/libavutil/libavutil.v index eb16ae175e..e9f04cba65 100644 --- a/libavutil/libavutil.v +++ b/libavutil/libavutil.v @@ -1,4 +1,4 @@ LIBAVUTIL_$MAJOR { - global: av*; ff_*; + global: av*; local: *; };