Skip to content

Commit

Permalink
Fix compilation with !HAVE_6REGS.
Browse files Browse the repository at this point in the history
Can be tested with:
$ ./configure --cc='cc -m32' --disable-optimizations --enable-pic
  • Loading branch information
cehoyos committed Apr 19, 2014
1 parent 72c93ab commit b38910c
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 19 deletions.
3 changes: 3 additions & 0 deletions libavcodec/x86/mathops.h
Expand Up @@ -24,6 +24,7 @@

#include "config.h"
#include "libavutil/common.h"
#include "libavutil/x86/asm.h"

#if HAVE_INLINE_ASM

Expand Down Expand Up @@ -88,6 +89,7 @@ static inline av_const int mid_pred(int a, int b, int c)
return i;
}

#if HAVE_6REGS
#define COPY3_IF_LT(x, y, a, b, c, d)\
__asm__ volatile(\
"cmpl %0, %3 \n\t"\
Expand All @@ -97,6 +99,7 @@ __asm__ volatile(\
: "+&r" (x), "+&r" (a), "+r" (c)\
: "r" (y), "r" (b), "r" (d)\
);
#endif /* HAVE_6REGS */
#endif /* HAVE_I686 */

#define MASK_ABS(mask, level) \
Expand Down
6 changes: 3 additions & 3 deletions libavcodec/x86/mpegaudiodsp.c
Expand Up @@ -45,7 +45,7 @@ void ff_four_imdct36_float_avx(float *out, float *buf, float *in, float *win,

DECLARE_ALIGNED(16, static float, mdct_win_sse)[2][4][4*40];

#if HAVE_SSE2_INLINE
#if HAVE_6REGS && HAVE_SSE2_INLINE

#define MACS(rt, ra, rb) rt+=(ra)*(rb)
#define MLSS(rt, ra, rb) rt-=(ra)*(rb)
Expand Down Expand Up @@ -189,7 +189,7 @@ static void apply_window_mp3(float *in, float *win, int *unused, float *out,
*out = sum;
}

#endif /* HAVE_SSE2_INLINE */
#endif /* HAVE_6REGS && HAVE_SSE2_INLINE */

#if HAVE_YASM
#define DECL_IMDCT_BLOCKS(CPU1, CPU2) \
Expand Down Expand Up @@ -255,7 +255,7 @@ av_cold void ff_mpadsp_init_x86(MPADSPContext *s)
}
}

#if HAVE_SSE2_INLINE
#if HAVE_6REGS && HAVE_SSE2_INLINE
if (INLINE_SSE2(cpu_flags)) {
s->apply_window_float = apply_window_mp3;
}
Expand Down
12 changes: 10 additions & 2 deletions libavcodec/x86/mpegvideoenc.c
Expand Up @@ -30,6 +30,8 @@
/* not permutated inverse zigzag_direct + 1 for MMX quantizer */
DECLARE_ALIGNED(16, static uint16_t, inv_zigzag_direct16)[64];

#if HAVE_6REGS

#if HAVE_MMX_INLINE
#define COMPILE_TEMPLATE_MMXEXT 0
#define COMPILE_TEMPLATE_SSE2 0
Expand Down Expand Up @@ -81,6 +83,8 @@ DECLARE_ALIGNED(16, static uint16_t, inv_zigzag_direct16)[64];
#include "mpegvideoenc_template.c"
#endif /* HAVE_SSSE3_INLINE */

#endif /* HAVE_6REGS */

#if HAVE_INLINE_ASM
static void denoise_dct_mmx(MpegEncContext *s, int16_t *block){
const int intra= s->mb_intra;
Expand Down Expand Up @@ -205,21 +209,25 @@ av_cold void ff_dct_encode_init_x86(MpegEncContext *s)
#if HAVE_MMX_INLINE
int cpu_flags = av_get_cpu_flags();
if (INLINE_MMX(cpu_flags)) {
#if HAVE_6REGS
s->dct_quantize = dct_quantize_MMX;
#endif
s->denoise_dct = denoise_dct_mmx;
}
#endif
#if HAVE_MMXEXT_INLINE
#if HAVE_6REGS && HAVE_MMXEXT_INLINE
if (INLINE_MMXEXT(cpu_flags))
s->dct_quantize = dct_quantize_MMXEXT;
#endif
#if HAVE_SSE2_INLINE
if (INLINE_SSE2(cpu_flags)) {
#if HAVE_6REGS
s->dct_quantize = dct_quantize_SSE2;
#endif
s->denoise_dct = denoise_dct_sse2;
}
#endif
#if HAVE_SSSE3_INLINE
#if HAVE_6REGS && HAVE_SSSE3_INLINE
if (INLINE_SSSE3(cpu_flags))
s->dct_quantize = dct_quantize_SSSE3;
#endif
Expand Down
6 changes: 6 additions & 0 deletions libavcodec/x86/snowdsp.c
Expand Up @@ -606,6 +606,7 @@ static void ff_snow_vertical_compose97i_mmx(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM
}
#endif //HAVE_7REGS

#if HAVE_6REGS
#define snow_inner_add_yblock_sse2_header \
IDWTELEM * * dst_array = sb->line + src_y;\
x86_reg tmp;\
Expand Down Expand Up @@ -873,6 +874,7 @@ static void ff_snow_inner_add_yblock_mmx(const uint8_t *obmc, const int obmc_str
else
ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
}
#endif /* HAVE_6REGS */

#endif /* HAVE_INLINE_ASM */

Expand All @@ -887,7 +889,9 @@ void ff_dwt_init_x86(SnowDWTContext *c)
#if HAVE_7REGS
c->vertical_compose97i = ff_snow_vertical_compose97i_sse2;
#endif
#if HAVE_6REGS
c->inner_add_yblock = ff_snow_inner_add_yblock_sse2;
#endif
}
else{
if (mm_flags & AV_CPU_FLAG_MMXEXT) {
Expand All @@ -896,7 +900,9 @@ void ff_dwt_init_x86(SnowDWTContext *c)
c->vertical_compose97i = ff_snow_vertical_compose97i_mmx;
#endif
}
#if HAVE_6REGS
c->inner_add_yblock = ff_snow_inner_add_yblock_mmx;
#endif
}
}
#endif /* HAVE_INLINE_ASM */
Expand Down
5 changes: 3 additions & 2 deletions libavcodec/x86/vc1dsp_init.c
Expand Up @@ -27,6 +27,7 @@
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/x86/cpu.h"
#include "libavutil/x86/asm.h"
#include "libavcodec/vc1dsp.h"
#include "fpel.h"
#include "vc1dsp.h"
Expand Down Expand Up @@ -86,10 +87,10 @@ av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
{
int cpu_flags = av_get_cpu_flags();

if (INLINE_MMX(cpu_flags))
if (HAVE_6REGS && INLINE_MMX(cpu_flags))
ff_vc1dsp_init_mmx(dsp);

if (INLINE_MMXEXT(cpu_flags))
if (HAVE_6REGS && INLINE_MMXEXT(cpu_flags))
ff_vc1dsp_init_mmxext(dsp);

#define ASSIGN_LF(EXT) \
Expand Down
4 changes: 2 additions & 2 deletions libavcodec/x86/vc1dsp_mmx.c
Expand Up @@ -33,7 +33,7 @@
#include "fpel.h"
#include "vc1dsp.h"

#if HAVE_INLINE_ASM
#if HAVE_6REGS && HAVE_INLINE_ASM

#define OP_PUT(S,D)
#define OP_AVG(S,D) "pavgb " #S ", " #D " \n\t"
Expand Down Expand Up @@ -760,4 +760,4 @@ av_cold void ff_vc1dsp_init_mmxext(VC1DSPContext *dsp)
dsp->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_mmxext;
dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_mmxext;
}
#endif /* HAVE_INLINE_ASM */
#endif /* HAVE_6REGS && HAVE_INLINE_ASM */
6 changes: 4 additions & 2 deletions libavcodec/x86/vp3dsp_init.c
Expand Up @@ -63,6 +63,7 @@ void ff_vp3_h_loop_filter_mmxext(uint8_t *src, int stride,
"paddb "#regb", "#regr" \n\t" \
"paddb "#regd", "#regp" \n\t"

#if HAVE_6REGS
static void put_vp_no_rnd_pixels8_l2_mmx(uint8_t *dst, const uint8_t *a, const uint8_t *b, ptrdiff_t stride, int h)
{
// START_TIMER
Expand Down Expand Up @@ -94,15 +95,16 @@ static void put_vp_no_rnd_pixels8_l2_mmx(uint8_t *dst, const uint8_t *a, const u
:"memory");
// STOP_TIMER("put_vp_no_rnd_pixels8_l2_mmx")
}
#endif /*HAVE_6REGS */
#endif /* HAVE_MMX_INLINE */

av_cold void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags)
{
int cpu_flags = av_get_cpu_flags();

#if HAVE_MMX_INLINE
#if HAVE_6REGS && HAVE_MMX_INLINE
c->put_no_rnd_pixels_l2 = put_vp_no_rnd_pixels8_l2_mmx;
#endif /* HAVE_MMX_INLINE */
#endif /* HAVE_6REGS && HAVE_MMX_INLINE */

#if ARCH_X86_32
if (EXTERNAL_MMX(cpu_flags)) {
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/x86/vp56_arith.h
Expand Up @@ -24,7 +24,7 @@
#ifndef AVCODEC_X86_VP56_ARITH_H
#define AVCODEC_X86_VP56_ARITH_H

#if HAVE_INLINE_ASM && HAVE_FAST_CMOV
#if HAVE_INLINE_ASM && HAVE_FAST_CMOV && HAVE_6REGS
#define vp56_rac_get_prob vp56_rac_get_prob
static av_always_inline int vp56_rac_get_prob(VP56RangeCoder *c, uint8_t prob)
{
Expand Down
4 changes: 3 additions & 1 deletion libavfilter/vf_noise.c
Expand Up @@ -289,7 +289,7 @@ static inline void line_noise_avg_c(uint8_t *dst, const uint8_t *src,
static inline void line_noise_avg_mmx(uint8_t *dst, const uint8_t *src,
int len, int8_t **shift)
{
#if HAVE_MMX_INLINE
#if HAVE_MMX_INLINE && HAVE_6REGS
x86_reg mmx_len= len&(~7);

__asm__ volatile(
Expand Down Expand Up @@ -438,7 +438,9 @@ static av_cold int init(AVFilterContext *ctx)
if (HAVE_MMX_INLINE &&
cpu_flags & AV_CPU_FLAG_MMX) {
n->line_noise = line_noise_mmx;
#if HAVE_6REGS
n->line_noise_avg = line_noise_avg_mmx;
#endif
}
if (HAVE_MMXEXT_INLINE &&
cpu_flags & AV_CPU_FLAG_MMXEXT)
Expand Down
6 changes: 6 additions & 0 deletions libswscale/x86/swscale_template.c
Expand Up @@ -666,6 +666,7 @@ static void RENAME(yuv2rgb555_X)(SwsContext *c, const int16_t *lumFilter,
#define WRITEBGR24(dst, dstw, index) WRITEBGR24MMX(dst, dstw, index)
#endif

#if HAVE_6REGS
static void RENAME(yuv2bgr24_X_ar)(SwsContext *c, const int16_t *lumFilter,
const int16_t **lumSrc, int lumFilterSize,
const int16_t *chrFilter, const int16_t **chrUSrc,
Expand Down Expand Up @@ -715,6 +716,7 @@ static void RENAME(yuv2bgr24_X)(SwsContext *c, const int16_t *lumFilter,
: "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S
);
}
#endif /* HAVE_6REGS */

#define REAL_WRITEYUY2(dst, dstw, index) \
"packuswb %%mm3, %%mm3 \n\t"\
Expand Down Expand Up @@ -1664,7 +1666,9 @@ static av_cold void RENAME(sws_init_swscale)(SwsContext *c)
if (!(c->flags & SWS_FULL_CHR_H_INT)) {
switch (c->dstFormat) {
case AV_PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X_ar); break;
#if HAVE_6REGS
case AV_PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X_ar); break;
#endif
case AV_PIX_FMT_RGB555: c->yuv2packedX = RENAME(yuv2rgb555_X_ar); break;
case AV_PIX_FMT_RGB565: c->yuv2packedX = RENAME(yuv2rgb565_X_ar); break;
case AV_PIX_FMT_YUYV422: c->yuv2packedX = RENAME(yuv2yuyv422_X_ar); break;
Expand All @@ -1677,7 +1681,9 @@ static av_cold void RENAME(sws_init_swscale)(SwsContext *c)
if (!(c->flags & SWS_FULL_CHR_H_INT)) {
switch (c->dstFormat) {
case AV_PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X); break;
#if HAVE_6REGS
case AV_PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X); break;
#endif
case AV_PIX_FMT_RGB555: c->yuv2packedX = RENAME(yuv2rgb555_X); break;
case AV_PIX_FMT_RGB565: c->yuv2packedX = RENAME(yuv2rgb565_X); break;
case AV_PIX_FMT_YUYV422: c->yuv2packedX = RENAME(yuv2yuyv422_X); break;
Expand Down
12 changes: 6 additions & 6 deletions libswscale/x86/yuv2rgb.c
Expand Up @@ -50,28 +50,28 @@ DECLARE_ASM_CONST(8, uint64_t, pb_03) = 0x0303030303030303ULL;
DECLARE_ASM_CONST(8, uint64_t, pb_07) = 0x0707070707070707ULL;

//MMX versions
#if HAVE_MMX_INLINE
#if HAVE_MMX_INLINE && HAVE_6REGS
#undef RENAME
#undef COMPILE_TEMPLATE_MMXEXT
#define COMPILE_TEMPLATE_MMXEXT 0
#define RENAME(a) a ## _mmx
#include "yuv2rgb_template.c"
#endif /* HAVE_MMX_INLINE */
#endif /* HAVE_MMX_INLINE && HAVE_6REGS */

// MMXEXT versions
#if HAVE_MMXEXT_INLINE
#if HAVE_MMXEXT_INLINE && HAVE_6REGS
#undef RENAME
#undef COMPILE_TEMPLATE_MMXEXT
#define COMPILE_TEMPLATE_MMXEXT 1
#define RENAME(a) a ## _mmxext
#include "yuv2rgb_template.c"
#endif /* HAVE_MMXEXT_INLINE */
#endif /* HAVE_MMXEXT_INLINE && HAVE_6REGS */

#endif /* HAVE_INLINE_ASM */

av_cold SwsFunc ff_yuv2rgb_init_x86(SwsContext *c)
{
#if HAVE_MMX_INLINE
#if HAVE_MMX_INLINE && HAVE_6REGS
int cpu_flags = av_get_cpu_flags();

#if HAVE_MMXEXT_INLINE
Expand Down Expand Up @@ -113,7 +113,7 @@ av_cold SwsFunc ff_yuv2rgb_init_x86(SwsContext *c)
return yuv420_rgb15_mmx;
}
}
#endif /* HAVE_MMX_INLINE */
#endif /* HAVE_MMX_INLINE && HAVE_6REGS */

return NULL;
}

0 comments on commit b38910c

Please sign in to comment.