[ffvpx] Update ffvp9/ffvp8 to 3.4.2-release

Structure of code was slightly modified so that it should be no longer necessary to re-generate the config_*.h files, greatly simplifying the resync process in the future.
This commit is contained in:
trav90 2018-04-26 16:49:15 -05:00 • committed by Roy Tam
commit d1361d3c21
183 changed files with 17773 additions and 28489 deletions

View file

@ -16,8 +16,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stddef.h>
#include <stdint.h>
#include <stdatomic.h>
#include "attributes.h"
#include "cpu.h"
#include "cpu_internal.h"
#include "config.h"
@ -44,10 +47,24 @@
#include <unistd.h>
#endif
static int flags, checked;
static atomic_int cpu_flags = ATOMIC_VAR_INIT(-1);
static int get_cpu_flags(void)
{
if (ARCH_AARCH64)
return ff_get_cpu_flags_aarch64();
if (ARCH_ARM)
return ff_get_cpu_flags_arm();
if (ARCH_PPC)
return ff_get_cpu_flags_ppc();
if (ARCH_X86)
return ff_get_cpu_flags_x86();
return 0;
}
void av_force_cpu_flags(int arg){
if ( (arg & ( AV_CPU_FLAG_3DNOW |
if (ARCH_X86 &&
(arg & ( AV_CPU_FLAG_3DNOW |
AV_CPU_FLAG_3DNOWEXT |
AV_CPU_FLAG_MMXEXT |
AV_CPU_FLAG_SSE |
@ -69,33 +86,23 @@ void av_force_cpu_flags(int arg){
arg |= AV_CPU_FLAG_MMX;
}
flags = arg;
checked = arg != -1;
atomic_store_explicit(&cpu_flags, arg, memory_order_relaxed);
}
int av_get_cpu_flags(void)
{
if (checked)
return flags;
if (ARCH_AARCH64)
flags = ff_get_cpu_flags_aarch64();
if (ARCH_ARM)
flags = ff_get_cpu_flags_arm();
if (ARCH_PPC)
flags = ff_get_cpu_flags_ppc();
if (ARCH_X86)
flags = ff_get_cpu_flags_x86();
checked = 1;
int flags = atomic_load_explicit(&cpu_flags, memory_order_relaxed);
if (flags == -1) {
flags = get_cpu_flags();
atomic_store_explicit(&cpu_flags, flags, memory_order_relaxed);
}
return flags;
}
void av_set_cpu_flags_mask(int mask)
{
checked = 0;
flags = av_get_cpu_flags() & mask;
checked = 1;
atomic_store_explicit(&cpu_flags, get_cpu_flags() & mask,
memory_order_relaxed);
}
int av_parse_cpu_flags(const char *s)
@ -294,3 +301,17 @@ int av_cpu_count(void)
return nb_cpus;
}
size_t av_cpu_max_align(void)
{
if (ARCH_AARCH64)
return ff_get_cpu_max_align_aarch64();
if (ARCH_ARM)
return ff_get_cpu_max_align_arm();
if (ARCH_PPC)
return ff_get_cpu_max_align_ppc();
if (ARCH_X86)
return ff_get_cpu_max_align_x86();
return 8;
}