remove arch specific code

This commit is contained in:
loki 2021-06-15 18:31:40 +02:00
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

Some files were not shown because too many files have changed in this diff Show more