remove arch specific code

This commit is contained in:
loki 2021-06-15 18:31:40 +02:00
parent 56bb4ca865
commit 71cef4b700
23 changed files with 57 additions and 1247 deletions

View File

@ -2,12 +2,6 @@ cmake_minimum_required(VERSION 3.0)
project(CBS)
SET(ARCH_SOURCE_FILES
x86/intmath.h
x86/asm.h
x86/mathops.h
)
SET(CBS_SOURCE_FILES
include/cbs/av1.h
include/cbs/cbs_av1.h
@ -36,10 +30,8 @@ cbs_sei.c
h2645_parse.c
h264_levels.c
attributes.h
bytestream.h
cbs_internal.h
avassert.h
defs.h
get_bits.h
h264_ps.h
@ -49,8 +41,7 @@ intmath.h
mathops.h
put_bits.h
vlc.h
${ARCH_SOURCE_FILES}
config.h
)
include_directories(include)
@ -60,16 +51,8 @@ include_directories(${SUNSHINE_PREPARED_BINARIES}/include)
endif()
add_compile_definitions(
ARCH_X86=1
ARCH_X86_64=1
HAVE_XMM_CLOBBERS=1
HAVE_INLINE_ASM=1
HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS=1
HAVE_THREADS=1
HAVE_FAST_UNALIGNED
HAVE_FAST_CLZ=1
HAVE_FAST_64BIT
PIC=1

View File

@ -1,144 +0,0 @@
/*
* Copyright (c) 2010 Mans Rullgard <mans@mansr.com>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_ARM_INTMATH_H
#define AVUTIL_ARM_INTMATH_H
#include <stdint.h>
#include "../attributes.h"
#if HAVE_INLINE_ASM
#if HAVE_ARMV6_INLINE
#define av_clip_uint8 av_clip_uint8_arm
static av_always_inline av_const int av_clip_uint8_arm(int a) {
int x;
__asm__("usat %0, #8, %1"
: "=r"(x)
: "r"(a));
return x;
}
#define av_clip_int8 av_clip_int8_arm
static av_always_inline av_const int av_clip_int8_arm(int a) {
int x;
__asm__("ssat %0, #8, %1"
: "=r"(x)
: "r"(a));
return x;
}
#define av_clip_uint16 av_clip_uint16_arm
static av_always_inline av_const int av_clip_uint16_arm(int a) {
int x;
__asm__("usat %0, #16, %1"
: "=r"(x)
: "r"(a));
return x;
}
#define av_clip_int16 av_clip_int16_arm
static av_always_inline av_const int av_clip_int16_arm(int a) {
int x;
__asm__("ssat %0, #16, %1"
: "=r"(x)
: "r"(a));
return x;
}
#define av_clip_intp2 av_clip_intp2_arm
static av_always_inline av_const int av_clip_intp2_arm(int a, int p) {
unsigned x;
__asm__("ssat %0, %2, %1"
: "=r"(x)
: "r"(a), "i"(p + 1));
return x;
}
#define av_clip_uintp2 av_clip_uintp2_arm
static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p) {
unsigned x;
__asm__("usat %0, %2, %1"
: "=r"(x)
: "r"(a), "i"(p));
return x;
}
#define av_sat_add32 av_sat_add32_arm
static av_always_inline int av_sat_add32_arm(int a, int b) {
int r;
__asm__("qadd %0, %1, %2"
: "=r"(r)
: "r"(a), "r"(b));
return r;
}
#define av_sat_dadd32 av_sat_dadd32_arm
static av_always_inline int av_sat_dadd32_arm(int a, int b) {
int r;
__asm__("qdadd %0, %1, %2"
: "=r"(r)
: "r"(a), "r"(b));
return r;
}
#define av_sat_sub32 av_sat_sub32_arm
static av_always_inline int av_sat_sub32_arm(int a, int b) {
int r;
__asm__("qsub %0, %1, %2"
: "=r"(r)
: "r"(a), "r"(b));
return r;
}
#define av_sat_dsub32 av_sat_dsub32_arm
static av_always_inline int av_sat_dsub32_arm(int a, int b) {
int r;
__asm__("qdsub %0, %1, %2"
: "=r"(r)
: "r"(a), "r"(b));
return r;
}
#endif /* HAVE_ARMV6_INLINE */
#if HAVE_ASM_MOD_Q
#define av_clipl_int32 av_clipl_int32_arm
static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a) {
int x, y;
__asm__("adds %1, %R2, %Q2, lsr #31 \n\t"
"itet ne \n\t"
"mvnne %1, #1<<31 \n\t"
"moveq %0, %Q2 \n\t"
"eorne %0, %1, %R2, asr #31 \n\t"
: "=r"(x), "=&r"(y)
: "r"(a)
: "cc");
return x;
}
#endif /* HAVE_ASM_MOD_Q */
#endif /* HAVE_INLINE_ASM */
#endif /* AVUTIL_ARM_INTMATH_H */

View File

@ -1,112 +0,0 @@
/*
* simple math operations
* Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> et al
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_ARM_MATHOPS_H
#define AVCODEC_ARM_MATHOPS_H
#include <stdint.h>
#include <libavutil/common.h>
#if HAVE_INLINE_ASM
#if HAVE_ARMV6_INLINE
#define MULH MULH
static inline av_const int MULH(int a, int b) {
int r;
__asm__("smmul %0, %1, %2"
: "=r"(r)
: "r"(a), "r"(b));
return r;
}
#define FASTDIV FASTDIV
static av_always_inline av_const int FASTDIV(int a, int b) {
int r;
__asm__("cmp %2, #2 \n\t"
"ldr %0, [%3, %2, lsl #2] \n\t"
"ite le \n\t"
"lsrle %0, %1, #1 \n\t"
"smmulgt %0, %0, %1 \n\t"
: "=&r"(r)
: "r"(a), "r"(b), "r"(ff_inverse)
: "cc");
return r;
}
#else /* HAVE_ARMV6_INLINE */
#define FASTDIV FASTDIV
static av_always_inline av_const int FASTDIV(int a, int b) {
int r, t;
__asm__("umull %1, %0, %2, %3"
: "=&r"(r), "=&r"(t)
: "r"(a), "r"(ff_inverse[b]));
return r;
}
#endif
#define MLS64(d, a, b) MAC64(d, -(a), b)
#if HAVE_ARMV5TE_INLINE
/* signed 16x16 -> 32 multiply add accumulate */
#define MAC16(rt, ra, rb) \
__asm__("smlabb %0, %1, %2, %0" \
: "+r"(rt) \
: "r"(ra), "r"(rb));
/* signed 16x16 -> 32 multiply */
#define MUL16 MUL16
static inline av_const int MUL16(int ra, int rb) {
int rt;
__asm__("smulbb %0, %1, %2"
: "=r"(rt)
: "r"(ra), "r"(rb));
return rt;
}
#endif
#define mid_pred mid_pred
static inline av_const int mid_pred(int a, int b, int c) {
int m;
__asm__(
"mov %0, %2 \n\t"
"cmp %1, %2 \n\t"
"itt gt \n\t"
"movgt %0, %1 \n\t"
"movgt %1, %2 \n\t"
"cmp %1, %3 \n\t"
"it le \n\t"
"movle %1, %3 \n\t"
"cmp %0, %1 \n\t"
"it gt \n\t"
"movgt %0, %1 \n\t"
: "=&r"(m), "+r"(a)
: "r"(b), "r"(c)
: "cc");
return m;
}
#endif /* HAVE_INLINE_ASM */
#endif /* AVCODEC_ARM_MATHOPS_H */

View File

@ -1,173 +0,0 @@
/*
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* Macro definitions for various function/variable attributes
*/
#ifndef AVUTIL_ATTRIBUTES_H
#define AVUTIL_ATTRIBUTES_H
#ifdef __GNUC__
#define AV_GCC_VERSION_AT_LEAST(x, y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
#define AV_GCC_VERSION_AT_MOST(x, y) (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y))
#else
#define AV_GCC_VERSION_AT_LEAST(x, y) 0
#define AV_GCC_VERSION_AT_MOST(x, y) 0
#endif
#ifdef __has_builtin
#define AV_HAS_BUILTIN(x) __has_builtin(x)
#else
#define AV_HAS_BUILTIN(x) 0
#endif
#ifndef av_always_inline
#if AV_GCC_VERSION_AT_LEAST(3, 1)
#define av_always_inline __attribute__((always_inline)) inline
#elif defined(_MSC_VER)
#define av_always_inline __forceinline
#else
#define av_always_inline inline
#endif
#endif
#ifndef av_extern_inline
#if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
#define av_extern_inline extern inline
#else
#define av_extern_inline inline
#endif
#endif
#if AV_GCC_VERSION_AT_LEAST(3, 4)
#define av_warn_unused_result __attribute__((warn_unused_result))
#else
#define av_warn_unused_result
#endif
#if AV_GCC_VERSION_AT_LEAST(3, 1)
#define av_noinline __attribute__((noinline))
#elif defined(_MSC_VER)
#define av_noinline __declspec(noinline)
#else
#define av_noinline
#endif
#if AV_GCC_VERSION_AT_LEAST(3, 1) || defined(__clang__)
#define av_pure __attribute__((pure))
#else
#define av_pure
#endif
#if AV_GCC_VERSION_AT_LEAST(2, 6) || defined(__clang__)
#define av_const __attribute__((const))
#else
#define av_const
#endif
#if AV_GCC_VERSION_AT_LEAST(4, 3) || defined(__clang__)
#define av_cold __attribute__((cold))
#else
#define av_cold
#endif
#if AV_GCC_VERSION_AT_LEAST(4, 1) && !defined(__llvm__)
#define av_flatten __attribute__((flatten))
#else
#define av_flatten
#endif
#if AV_GCC_VERSION_AT_LEAST(3, 1)
#define attribute_deprecated __attribute__((deprecated))
#elif defined(_MSC_VER)
#define attribute_deprecated __declspec(deprecated)
#else
#define attribute_deprecated
#endif
/**
* Disable warnings about deprecated features
* This is useful for sections of code kept for backward compatibility and
* scheduled for removal.
*/
#ifndef AV_NOWARN_DEPRECATED
#if AV_GCC_VERSION_AT_LEAST(4, 6)
#define AV_NOWARN_DEPRECATED(code) \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
code \
_Pragma("GCC diagnostic pop")
#elif defined(_MSC_VER)
#define AV_NOWARN_DEPRECATED(code) \
__pragma(warning(push)) \
__pragma(warning(disable : 4996)) \
code; \
__pragma(warning(pop))
#else
#define AV_NOWARN_DEPRECATED(code) code
#endif
#endif
#if defined(__GNUC__) || defined(__clang__)
#define av_unused __attribute__((unused))
#else
#define av_unused
#endif
/**
* Mark a variable as used and prevent the compiler from optimizing it
* away. This is useful for variables accessed only from inline
* assembler without the compiler being aware.
*/
#if AV_GCC_VERSION_AT_LEAST(3, 1) || defined(__clang__)
#define av_used __attribute__((used))
#else
#define av_used
#endif
#if AV_GCC_VERSION_AT_LEAST(3, 3) || defined(__clang__)
#define av_alias __attribute__((may_alias))
#else
#define av_alias
#endif
#if(defined(__GNUC__) || defined(__clang__)) && !defined(__INTEL_COMPILER)
#define av_uninit(x) x = x
#else
#define av_uninit(x) x
#endif
#if defined(__GNUC__) || defined(__clang__)
#define av_builtin_constant_p __builtin_constant_p
#define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
#else
#define av_builtin_constant_p(x) 0
#define av_printf_format(fmtpos, attrpos)
#endif
#if AV_GCC_VERSION_AT_LEAST(2, 5) || defined(__clang__)
#define av_noreturn __attribute__((noreturn))
#else
#define av_noreturn
#endif
#endif /* AVUTIL_ATTRIBUTES_H */

View File

@ -1,77 +0,0 @@
/*
* copyright (c) 2010 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* simple assert() macros that are a bit more flexible than ISO C assert().
* @author Michael Niedermayer <michaelni@gmx.at>
*/
#ifndef AVUTIL_AVASSERT_H
#define AVUTIL_AVASSERT_H
#include <stdlib.h>
#include <libavutil/avutil.h>
#include <libavutil/log.h>
/**
* assert() equivalent, that is always enabled.
*/
#define av_assert0(cond) \
do { \
if(!(cond)) { \
av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \
AV_STRINGIFY(cond), __FILE__, __LINE__); \
abort(); \
} \
} while(0)
/**
* assert() equivalent, that does not lie in speed critical code.
* These asserts() thus can be enabled without fearing speed loss.
*/
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0
#define av_assert1(cond) av_assert0(cond)
#else
#define av_assert1(cond) ((void)0)
#endif
/**
* assert() equivalent, that does lie in speed critical code.
*/
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
#define av_assert2(cond) av_assert0(cond)
#define av_assert2_fpu() av_assert0_fpu()
#else
#define av_assert2(cond) ((void)0)
#define av_assert2_fpu() ((void)0)
#endif
/**
* Assert that floating point operations can be executed.
*
* This will av_assert0() that the cpu is not in MMX state on X86
*/
void av_assert0_fpu(void);
#endif /* AVUTIL_AVASSERT_H */

View File

@ -1,111 +0,0 @@
/*
* Simple math operations
* Copyright (c) 2009 Mans Rullgard <mans@mansr.com>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_AVR32_MATHOPS_H
#define AVCODEC_AVR32_MATHOPS_H
#include <stdint.h>
#include <libavutil/common.h>
#if HAVE_INLINE_ASM
#define MULL MULL
static inline av_const int MULL(int a, int b, unsigned shift) {
union {
int64_t x;
int hl[2];
} x;
__asm__("muls.d %0, %1, %2 \n\t"
"lsr %0, %3 \n\t"
"or %0, %0, %m0<<%4 \n\t"
: "=r"(x)
: "r"(b), "r"(a), "i"(shift), "i"(32 - shift));
return x.hl[1];
}
#define MULH MULH
static inline av_const int MULH(int a, int b) {
union {
int64_t x;
int hl[2];
} x;
__asm__("muls.d %0, %1, %2"
: "=r"(x.x)
: "r"(a), "r"(b));
return x.hl[0];
}
#define MUL64 MUL64
static inline av_const int64_t MUL64(int a, int b) {
int64_t x;
__asm__("muls.d %0, %1, %2"
: "=r"(x)
: "r"(a), "r"(b));
return x;
}
static inline av_const int64_t MAC64(int64_t d, int a, int b) {
__asm__("macs.d %0, %1, %2"
: "+r"(d)
: "r"(a), "r"(b));
return d;
}
#define MAC64(d, a, b) ((d) = MAC64(d, a, b))
#define MLS64(d, a, b) MAC64(d, -(a), b)
static inline av_const int MAC16(int d, int a, int b) {
__asm__("machh.w %0, %1:b, %2:b"
: "+r"(d)
: "r"(a), "r"(b));
return d;
}
#define MAC16(d, a, b) ((d) = MAC16(d, a, b))
#define MLS16(d, a, b) MAC16(d, -(a), b)
#define MUL16 MUL16
static inline av_const int MUL16(int a, int b) {
int d;
__asm__("mulhh.w %0, %1:b, %2:b"
: "=r"(d)
: "r"(a), "r"(b));
return d;
}
#define mid_pred mid_pred
static inline av_const int mid_pred(int a, int b, int c) {
int m;
__asm__("mov %0, %2 \n\t"
"cp.w %1, %2 \n\t"
"movgt %0, %1 \n\t"
"movgt %1, %2 \n\t"
"cp.w %1, %3 \n\t"
"movle %1, %3 \n\t"
"cp.w %0, %1 \n\t"
"movgt %0, %1 \n\t"
: "=&r"(m), "+r"(a)
: "r"(b), "r"(c));
return m;
}
#endif /* HAVE_INLINE_ASM */
#endif /* AVCODEC_AVR32_MATHOPS_H */

View File

@ -23,10 +23,12 @@
#ifndef AVCODEC_BYTESTREAM_H
#define AVCODEC_BYTESTREAM_H
#include "config.h"
#include <stdint.h>
#include <string.h>
#include "avassert.h"
#include <libavutil/avassert.h>
#include <libavutil/common.h>
#include <libavutil/intreadwrite.h>

14
third-party/cbs/cbs.c vendored
View File

@ -18,14 +18,13 @@
#include <string.h>
#include <libavutil/avassert.h>
#include <libavutil/buffer.h>
#include <libavutil/common.h>
#include <libavutil/opt.h>
#include <libavcodec/avcodec.h>
#include "avassert.h"
#include "cbs/cbs.h"
#include "cbs_internal.h"
@ -1038,3 +1037,14 @@ int ff_cbs_make_unit_writable(CodedBitstreamContext *ctx,
unit->content = unit->content_ref->data;
return 0;
}
const uint8_t ff_log2_tab[256] = {
0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
};

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avassert.h"
#include <libavutil/avassert.h>
#include <libavutil/opt.h>
#include <libavutil/pixfmt.h>

View File

@ -16,9 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "attributes.h"
#include "avassert.h"
#include <libavutil/attributes.h>
#include <libavutil/avassert.h>
#include "cbs/cbs.h"
#include "cbs/cbs_h264.h"

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avassert.h"
#include <libavutil/avassert.h>
#include "cbs/cbs.h"
#include "cbs/cbs_mpeg2.h"

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avassert.h"
#include <libavutil/avassert.h>
#include "cbs/cbs.h"
#include "cbs/cbs_vp9.h"

27
third-party/cbs/config.h vendored Normal file
View File

@ -0,0 +1,27 @@
#ifndef CBS_CONFIG_H
#define CBS_CONFIG_H
#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || \
defined(__BIG_ENDIAN__) || \
defined(__ARMEB__) || \
defined(__THUMBEB__) || \
defined(__AARCH64EB__) || \
defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)
// It's a big-endian target architecture
#define AV_HAVE_BIGENDIAN 1
#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || \
defined(__LITTLE_ENDIAN__) || \
defined(__ARMEL__) || \
defined(__THUMBEL__) || \
defined(__AARCH64EL__) || \
defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || \
defined(_WIN32)
// It's a little-endian target architecture
#define AV_HAVE_BIGENDIAN 0
#else
#error "Unknown Endianness"
#endif
#endif

View File

@ -29,8 +29,7 @@
#include <stdint.h>
#include "avassert.h"
#include <libavutil/avassert.h>
#include <libavutil/common.h>
#include <libavutil/intreadwrite.h>
#include <libavutil/log.h>

View File

@ -28,6 +28,7 @@
#include "cbs/hevc.h"
#include "bytestream.h"
#include "config.h"
#include "get_bits.h"
#include "intmath.h"

View File

@ -23,14 +23,7 @@
#include <stdint.h>
#include "attributes.h"
#if ARCH_ARM
#include "arm/intmath.h"
#endif
#if ARCH_X86
#include "x86/intmath.h"
#endif
#include <libavutil/attributes.h>
#if HAVE_FAST_CLZ
#if AV_GCC_VERSION_AT_LEAST(3, 4)

View File

@ -22,6 +22,8 @@
#ifndef AVCODEC_MATHOPS_H
#define AVCODEC_MATHOPS_H
#include "config.h"
#include <stdint.h>
#include <libavutil/common.h>
@ -35,20 +37,6 @@ extern const uint8_t ff_crop_tab[256 + 2 * MAX_NEG_CROP];
extern const uint8_t ff_zigzag_direct[64];
extern const uint8_t ff_zigzag_scan[16 + 1];
#if ARCH_ARM
#include "arm/mathops.h"
#elif ARCH_AVR32
#include "avr32/mathops.h"
#elif ARCH_MIPS
#include "mips/mathops.h"
#elif ARCH_PPC
#include "ppc/mathops.h"
#elif ARCH_X86
#include "x86/mathops.h"
#endif
/* generic implementation */
#ifndef MUL64
#define MUL64(a, b) ((int64_t)(a) * (int64_t)(b))
#endif

View File

@ -1,65 +0,0 @@
/*
* Copyright (c) 2009 Mans Rullgard <mans@mansr.com>
* Copyright (c) 2015 Zhou Xiaoyong <zhouxiaoyong@loongson.cn>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_MIPS_MATHOPS_H
#define AVCODEC_MIPS_MATHOPS_H
#include <stdint.h>
#include <libavutil/common.h>
#if HAVE_INLINE_ASM
#if HAVE_LOONGSON3
#define MULH MULH
static inline av_const int MULH(int a, int b) {
int c;
__asm__("dmult %1, %2 \n\t"
"mflo %0 \n\t"
"dsrl %0, %0, 32 \n\t"
: "=r"(c)
: "r"(a), "r"(b)
: "hi", "lo");
return c;
}
#define mid_pred mid_pred
static inline av_const int mid_pred(int a, int b, int c) {
int t = b;
__asm__("sgt $8, %1, %2 \n\t"
"movn %0, %1, $8 \n\t"
"movn %1, %2, $8 \n\t"
"sgt $8, %1, %3 \n\t"
"movz %1, %3, $8 \n\t"
"sgt $8, %0, %1 \n\t"
"movn %0, %1, $8 \n\t"
: "+&r"(t), "+&r"(a)
: "r"(b), "r"(c)
: "$8");
return t;
}
#endif /* HAVE_LOONGSON3 */
#endif /* HAVE_INLINE_ASM */
#endif /* AVCODEC_MIPS_MATHOPS_H */

View File

@ -1,87 +0,0 @@
/*
* simple math operations
* Copyright (c) 2001, 2002 Fabrice Bellard
* Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> et al
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_PPC_MATHOPS_H
#define AVCODEC_PPC_MATHOPS_H
#include <stdint.h>
#include <libavutil/common.h>
#if HAVE_PPC4XX
/* signed 16x16 -> 32 multiply add accumulate */
#define MAC16(rt, ra, rb) \
__asm__("maclhw %0, %2, %3" \
: "=r"(rt) \
: "0"(rt), "r"(ra), "r"(rb));
/* signed 16x16 -> 32 multiply */
#define MUL16(ra, rb) \
({ int __rt; \
__asm__ ("mullhw %0, %1, %2" : "=r" (__rt) : "r" (ra), "r" (rb)); \
__rt; })
#endif
#define MULH MULH
static inline av_const int MULH(int a, int b) {
int r;
__asm__("mulhw %0, %1, %2"
: "=r"(r)
: "r"(a), "r"(b));
return r;
}
#if !ARCH_PPC64
static inline av_const int64_t MAC64(int64_t d, int a, int b) {
union {
uint64_t x;
unsigned hl[2];
} x = { d };
int h, l;
__asm__("mullw %3, %4, %5 \n\t"
"mulhw %2, %4, %5 \n\t"
"addc %1, %1, %3 \n\t"
"adde %0, %0, %2 \n\t"
: "+r"(x.hl[0]), "+r"(x.hl[1]), "=&r"(h), "=&r"(l)
: "r"(a), "r"(b));
return x.x;
}
#define MAC64(d, a, b) ((d) = MAC64(d, a, b))
static inline av_const int64_t MLS64(int64_t d, int a, int b) {
union {
uint64_t x;
unsigned hl[2];
} x = { d };
int h, l;
__asm__("mullw %3, %4, %5 \n\t"
"mulhw %2, %4, %5 \n\t"
"subfc %1, %3, %1 \n\t"
"subfe %0, %2, %0 \n\t"
: "+r"(x.hl[0]), "+r"(x.hl[1]), "=&r"(h), "=&r"(l)
: "r"(a), "r"(b));
return x.x;
}
#define MLS64(d, a, b) ((d) = MLS64(d, a, b))
#endif
#endif /* AVCODEC_PPC_MATHOPS_H */

View File

@ -26,15 +26,15 @@
#ifndef AVCODEC_PUT_BITS_H
#define AVCODEC_PUT_BITS_H
#include "config.h"
#include <stddef.h>
#include <stdint.h>
#include <libavutil/avassert.h>
#include <libavutil/intreadwrite.h>
#include "avassert.h"
#if ARCH_X86_64
// TODO: Benchmark and optionally enable on other 64-bit architectures.
#if HAVE_FAST_64BIT
typedef uint64_t BitBuf;
#define AV_WBBUF AV_WB64
#define AV_WLBUF AV_WL64

View File

@ -1,157 +0,0 @@
/*
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_X86_ASM_H
#define AVUTIL_X86_ASM_H
#include <stdint.h>
typedef struct xmm_reg {
uint64_t a, b;
} xmm_reg;
typedef struct ymm_reg {
uint64_t a, b, c, d;
} ymm_reg;
#if ARCH_X86_64
#define FF_OPSIZE "q"
#define FF_REG_a "rax"
#define FF_REG_b "rbx"
#define FF_REG_c "rcx"
#define FF_REG_d "rdx"
#define FF_REG_D "rdi"
#define FF_REG_S "rsi"
#define FF_PTR_SIZE "8"
typedef int64_t x86_reg;
/* FF_REG_SP is defined in Solaris sys headers, so use FF_REG_sp */
#define FF_REG_sp "rsp"
#define FF_REG_BP "rbp"
#define FF_REGBP rbp
#define FF_REGa rax
#define FF_REGb rbx
#define FF_REGc rcx
#define FF_REGd rdx
#define FF_REGSP rsp
#elif ARCH_X86_32
#define FF_OPSIZE "l"
#define FF_REG_a "eax"
#define FF_REG_b "ebx"
#define FF_REG_c "ecx"
#define FF_REG_d "edx"
#define FF_REG_D "edi"
#define FF_REG_S "esi"
#define FF_PTR_SIZE "4"
typedef int32_t x86_reg;
#define FF_REG_sp "esp"
#define FF_REG_BP "ebp"
#define FF_REGBP ebp
#define FF_REGa eax
#define FF_REGb ebx
#define FF_REGc ecx
#define FF_REGd edx
#define FF_REGSP esp
#else
typedef int x86_reg;
#endif
#define HAVE_7REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE && HAVE_EBP_AVAILABLE))
#define HAVE_6REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE || HAVE_EBP_AVAILABLE))
#if ARCH_X86_64 && defined(PIC)
#define BROKEN_RELOCATIONS 1
#endif
/*
* If gcc is not set to support sse (-msse) it will not accept xmm registers
* in the clobber list for inline asm. XMM_CLOBBERS takes a list of xmm
* registers to be marked as clobbered and evaluates to nothing if they are
* not supported, or to the list itself if they are supported. Since a clobber
* list may not be empty, XMM_CLOBBERS_ONLY should be used if the xmm
* registers are the only in the clobber list.
* For example a list with "eax" and "xmm0" as clobbers should become:
* : XMM_CLOBBERS("xmm0",) "eax"
* and a list with only "xmm0" should become:
* XMM_CLOBBERS_ONLY("xmm0")
*/
#if HAVE_XMM_CLOBBERS
#define XMM_CLOBBERS(...) __VA_ARGS__
#define XMM_CLOBBERS_ONLY(...) : __VA_ARGS__
#else
#define XMM_CLOBBERS(...)
#define XMM_CLOBBERS_ONLY(...)
#endif
/* Use to export labels from asm. */
#define LABEL_MANGLE(a) EXTERN_PREFIX #a
// Use rip-relative addressing if compiling PIC code on x86-64.
#if ARCH_X86_64 && defined(PIC)
#define LOCAL_MANGLE(a) #a "(%%rip)"
#else
#define LOCAL_MANGLE(a) #a
#endif
#if HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS
#define MANGLE(a) EXTERN_PREFIX LOCAL_MANGLE(a)
#define NAMED_CONSTRAINTS_ADD(...)
#define NAMED_CONSTRAINTS(...)
#define NAMED_CONSTRAINTS_ARRAY_ADD(...)
#define NAMED_CONSTRAINTS_ARRAY(...)
#else
/* When direct symbol references are used in code passed to a compiler that does not support them
* then these references need to be converted to named asm constraints instead.
* Instead of returning a direct symbol MANGLE now returns a named constraint for that specific symbol.
* In order for this to work there must also be a corresponding entry in the asm-interface. To add this
* entry use the macro NAMED_CONSTRAINTS() and pass in a list of each symbol reference used in the
* corresponding block of code. (e.g. NAMED_CONSTRAINTS(var1,var2,var3) where var1 is the first symbol etc. ).
* If there are already existing constraints then use NAMED_CONSTRAINTS_ADD to add to the existing constraint list.
*/
#define MANGLE(a) "%[" #a "]"
// Intel/MSVC does not correctly expand va-args so we need a rather ugly hack in order to get it to work
#define FE_0(P, X) P(X)
#define FE_1(P, X, X1) P(X), FE_0(P, X1)
#define FE_2(P, X, X1, X2) P(X), FE_1(P, X1, X2)
#define FE_3(P, X, X1, X2, X3) P(X), FE_2(P, X1, X2, X3)
#define FE_4(P, X, X1, X2, X3, X4) P(X), FE_3(P, X1, X2, X3, X4)
#define FE_5(P, X, X1, X2, X3, X4, X5) P(X), FE_4(P, X1, X2, X3, X4, X5)
#define FE_6(P, X, X1, X2, X3, X4, X5, X6) P(X), FE_5(P, X1, X2, X3, X4, X5, X6)
#define FE_7(P, X, X1, X2, X3, X4, X5, X6, X7) P(X), FE_6(P, X1, X2, X3, X4, X5, X6, X7)
#define FE_8(P, X, X1, X2, X3, X4, X5, X6, X7, X8) P(X), FE_7(P, X1, X2, X3, X4, X5, X6, X7, X8)
#define FE_9(P, X, X1, X2, X3, X4, X5, X6, X7, X8, X9) P(X), FE_8(P, X1, X2, X3, X4, X5, X6, X7, X8, X9)
#define GET_FE_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, NAME, ...) NAME
#define GET_FE(A) GET_FE_IMPL A
#define GET_FE_GLUE(x, y) x y
#define FOR_EACH_VA(P, ...) GET_FE_GLUE(GET_FE((__VA_ARGS__, FE_9, FE_8, FE_7, FE_6, FE_5, FE_4, FE_3, FE_2, FE_1, FE_0)), (P, __VA_ARGS__))
#define NAME_CONSTRAINT(x) [x] "m"(x)
// Parameters are a list of each symbol reference required
#define NAMED_CONSTRAINTS_ADD(...) , FOR_EACH_VA(NAME_CONSTRAINT, __VA_ARGS__)
// Same but without comma for when there are no previously defined constraints
#define NAMED_CONSTRAINTS(...) FOR_EACH_VA(NAME_CONSTRAINT, __VA_ARGS__)
// Same as above NAMED_CONSTRAINTS except used for passing arrays/pointers instead of normal variables
#define NAME_CONSTRAINT_ARRAY(x) [x] "m"(*x)
#define NAMED_CONSTRAINTS_ARRAY_ADD(...) , FOR_EACH_VA(NAME_CONSTRAINT_ARRAY, __VA_ARGS__)
#define NAMED_CONSTRAINTS_ARRAY(...) FOR_EACH_VA(NAME_CONSTRAINT_ARRAY, __VA_ARGS__)
#endif
#endif /* AVUTIL_X86_ASM_H */

View File

@ -1,145 +0,0 @@
/*
* Copyright (c) 2015 James Almer
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_X86_INTMATH_H
#define AVUTIL_X86_INTMATH_H
#include <stdint.h>
#include <stdlib.h>
#if HAVE_FAST_CLZ
#if defined(_MSC_VER)
#include <intrin.h>
#elif defined(__INTEL_COMPILER)
#include <immintrin.h>
#endif
#endif
#if HAVE_FAST_CLZ
#if(defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1216)) || defined(_MSC_VER)
#if defined(__INTEL_COMPILER)
#define ff_log2(x) (_bit_scan_reverse((x) | 1))
#else
#define ff_log2 ff_log2_x86
static av_always_inline av_const int ff_log2_x86(unsigned int v) {
unsigned long n;
_BitScanReverse(&n, v | 1);
return n;
}
#endif
#define ff_log2_16bit av_log2
#if defined(__INTEL_COMPILER) || (defined(_MSC_VER) && (_MSC_VER >= 1700) && \
(defined(__BMI__) || !defined(__clang__)))
#define ff_ctz(v) _tzcnt_u32(v)
#if ARCH_X86_64
#define ff_ctzll(v) _tzcnt_u64(v)
#else
#define ff_ctzll ff_ctzll_x86
static av_always_inline av_const int ff_ctzll_x86(long long v) {
return ((uint32_t)v == 0) ? _tzcnt_u32((uint32_t)(v >> 32)) + 32 : _tzcnt_u32((uint32_t)v);
}
#endif
#endif /* _MSC_VER */
#endif /* __INTEL_COMPILER */
#endif /* HAVE_FAST_CLZ */
#if defined(__GNUC__)
/* Our generic version of av_popcount is faster than GCC's built-in on
* CPUs that don't support the popcnt instruction.
*/
#if defined(__POPCNT__)
#define av_popcount __builtin_popcount
#if ARCH_X86_64
#define av_popcount64 __builtin_popcountll
#endif
#endif /* __POPCNT__ */
#if defined(__BMI2__)
#if AV_GCC_VERSION_AT_LEAST(5, 1)
#define av_mod_uintp2 __builtin_ia32_bzhi_si
#elif HAVE_INLINE_ASM
/* GCC releases before 5.1.0 have a broken bzhi builtin, so for those we
* implement it using inline assembly
*/
#define av_mod_uintp2 av_mod_uintp2_bmi2
static av_always_inline av_const unsigned av_mod_uintp2_bmi2(unsigned a, unsigned p) {
if(av_builtin_constant_p(p))
return a & ((1 << p) - 1);
else {
unsigned x;
__asm__("bzhi %2, %1, %0 \n\t"
: "=r"(x)
: "rm"(a), "r"(p));
return x;
}
}
#endif /* AV_GCC_VERSION_AT_LEAST */
#endif /* __BMI2__ */
#ifdef av_clipd
#undef av_clipd
#endif
#ifdef av_clipf
#undef av_clipf
#endif
#if defined(__SSE2__) && !defined(__INTEL_COMPILER)
#define av_clipd av_clipd_sse2
static av_always_inline av_const double av_clipd_sse2(double a, double amin, double amax) {
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
if(amin > amax) abort();
#endif
__asm__("minsd %2, %0 \n\t"
"maxsd %1, %0 \n\t"
: "+&x"(a)
: "xm"(amin), "xm"(amax));
return a;
}
#endif /* __SSE2__ */
#if defined(__SSE__) && !defined(__INTEL_COMPILER)
#define av_clipf av_clipf_sse
static av_always_inline av_const float av_clipf_sse(float a, float amin, float amax) {
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
if(amin > amax) abort();
#endif
__asm__("minss %2, %0 \n\t"
"maxss %1, %0 \n\t"
: "+&x"(a)
: "xm"(amin), "xm"(amax));
return a;
}
#endif /* __SSE__ */
#endif /* __GNUC__ */
#endif /* AVUTIL_X86_INTMATH_H */

View File

@ -1,121 +0,0 @@
/*
* simple math operations
* Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> et al
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_X86_MATHOPS_H
#define AVCODEC_X86_MATHOPS_H
#include <libavutil/common.h>
#include "asm.h"
#if HAVE_INLINE_ASM
#if ARCH_X86_32
#define MULL MULL
static av_always_inline av_const int MULL(int a, int b, unsigned shift) {
int rt, dummy;
__asm__(
"imull %3 \n\t"
"shrdl %4, %%edx, %%eax \n\t"
: "=a"(rt), "=d"(dummy)
: "a"(a), "rm"(b), "ci"((uint8_t)shift));
return rt;
}
#define MULH MULH
static av_always_inline av_const int MULH(int a, int b) {
int rt, dummy;
__asm__(
"imull %3"
: "=d"(rt), "=a"(dummy)
: "a"(a), "rm"(b));
return rt;
}
#define MUL64 MUL64
static av_always_inline av_const int64_t MUL64(int a, int b) {
int64_t rt;
__asm__(
"imull %2"
: "=A"(rt)
: "a"(a), "rm"(b));
return rt;
}
#endif /* ARCH_X86_32 */
#if HAVE_I686
/* median of 3 */
#define mid_pred mid_pred
static inline av_const int mid_pred(int a, int b, int c) {
int i = b;
__asm__(
"cmp %2, %1 \n\t"
"cmovg %1, %0 \n\t"
"cmovg %2, %1 \n\t"
"cmp %3, %1 \n\t"
"cmovl %3, %1 \n\t"
"cmp %1, %0 \n\t"
"cmovg %1, %0 \n\t"
: "+&r"(i), "+&r"(a)
: "r"(b), "r"(c));
return i;
}
#if HAVE_6REGS
#define COPY3_IF_LT(x, y, a, b, c, d) \
__asm__ volatile( \
"cmpl %0, %3 \n\t" \
"cmovl %3, %0 \n\t" \
"cmovl %4, %1 \n\t" \
"cmovl %5, %2 \n\t" \
: "+&r"(x), "+&r"(a), "+r"(c) \
: "r"(y), "r"(b), "r"(d));
#endif /* HAVE_6REGS */
#endif /* HAVE_I686 */
#define MASK_ABS(mask, level) \
__asm__("cdq \n\t" \
"xorl %1, %0 \n\t" \
"subl %1, %0 \n\t" \
: "+a"(level), "=&d"(mask))
// avoid +32 for shift optimization (gcc should do that ...)
#define NEG_SSR32 NEG_SSR32
static inline int32_t NEG_SSR32(int32_t a, int8_t s) {
__asm__("sarl %1, %0\n\t"
: "+r"(a)
: "ic"((uint8_t)(-s)));
return a;
}
#define NEG_USR32 NEG_USR32
static inline uint32_t NEG_USR32(uint32_t a, int8_t s) {
__asm__("shrl %1, %0\n\t"
: "+r"(a)
: "ic"((uint8_t)(-s)));
return a;
}
#endif /* HAVE_INLINE_ASM */
#endif /* AVCODEC_X86_MATHOPS_H */