mirror of
https://github.com/love2d/love-android.git
synced 2026-08-21 13:09:40 +02:00
added building of the theora library
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2010 *
|
||||
* by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function:
|
||||
last mod: $Id: x86int.h 17344 2010-07-21 01:42:18Z tterribe $
|
||||
|
||||
********************************************************************/
|
||||
#if !defined(_arm_armbits_H)
|
||||
# define _arm_armbits_H (1)
|
||||
# include "../bitpack.h"
|
||||
# include "armcpu.h"
|
||||
|
||||
# if defined(OC_ARM_ASM)
|
||||
# define oc_pack_read oc_pack_read_arm
|
||||
# define oc_pack_read1 oc_pack_read1_arm
|
||||
# define oc_huff_token_decode oc_huff_token_decode_arm
|
||||
# endif
|
||||
|
||||
long oc_pack_read_arm(oc_pack_buf *_b,int _bits);
|
||||
int oc_pack_read1_arm(oc_pack_buf *_b);
|
||||
int oc_huff_token_decode_arm(oc_pack_buf *_b,const ogg_int16_t *_tree);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,116 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2010 *
|
||||
* by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
CPU capability detection for ARM processors.
|
||||
|
||||
function:
|
||||
last mod: $Id: cpu.c 17344 2010-07-21 01:42:18Z tterribe $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include "armcpu.h"
|
||||
|
||||
#if !defined(OC_ARM_ASM)|| \
|
||||
!defined(OC_ARM_ASM_EDSP)&&!defined(OC_ARM_ASM_MEDIA)&& \
|
||||
!defined(OC_ARM_ASM_NEON)
|
||||
ogg_uint32_t oc_cpu_flags_get(void){
|
||||
return 0;
|
||||
}
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
/*For GetExceptionCode() and EXCEPTION_ILLEGAL_INSTRUCTION.*/
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_EXTRA_LEAN
|
||||
# include <windows.h>
|
||||
|
||||
ogg_uint32_t oc_cpu_flags_get(void){
|
||||
ogg_uint32_t flags;
|
||||
flags=0;
|
||||
/*MSVC has no inline __asm support for ARM, but it does let you __emit
|
||||
instructions via their assembled hex code.
|
||||
All of these instructions should be essentially nops.*/
|
||||
# if defined(OC_ARM_ASM_EDSP)
|
||||
__try{
|
||||
/*PLD [r13]*/
|
||||
__emit(0xF5DDF000);
|
||||
flags|=OC_CPU_ARM_EDSP;
|
||||
}
|
||||
__except(GetExceptionCode()==EXCEPTION_ILLEGAL_INSTRUCTION){
|
||||
/*Ignore exception.*/
|
||||
}
|
||||
# if defined(OC_ARM_ASM_MEDIA)
|
||||
__try{
|
||||
/*SHADD8 r3,r3,r3*/
|
||||
__emit(0xE6333F93);
|
||||
flags|=OC_CPU_ARM_MEDIA;
|
||||
}
|
||||
__except(GetExceptionCode()==EXCEPTION_ILLEGAL_INSTRUCTION){
|
||||
/*Ignore exception.*/
|
||||
}
|
||||
# if defined(OC_ARM_ASM_NEON)
|
||||
__try{
|
||||
/*VORR q0,q0,q0*/
|
||||
__emit(0xF2200150);
|
||||
flags|=OC_CPU_ARM_NEON;
|
||||
}
|
||||
__except(GetExceptionCode()==EXCEPTION_ILLEGAL_INSTRUCTION){
|
||||
/*Ignore exception.*/
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
return flags;
|
||||
}
|
||||
|
||||
#elif defined(__linux__)
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
|
||||
ogg_uint32_t oc_cpu_flags_get(void){
|
||||
ogg_uint32_t flags;
|
||||
FILE *fin;
|
||||
flags=0;
|
||||
/*Reading /proc/self/auxv would be easier, but that doesn't work reliably on
|
||||
Android.
|
||||
This also means that detection will fail in Scratchbox.*/
|
||||
fin=fopen("/proc/cpuinfo","r");
|
||||
if(fin!=NULL){
|
||||
/*512 should be enough for anybody (it's even enough for all the flags that
|
||||
x86 has accumulated... so far).*/
|
||||
char buf[512];
|
||||
while(fgets(buf,511,fin)!=NULL){
|
||||
if(memcmp(buf,"Features",8)==0){
|
||||
char *p;
|
||||
p=strstr(buf," edsp");
|
||||
if(p!=NULL&&(p[5]==' '||p[5]=='\n'))flags|=OC_CPU_ARM_EDSP;
|
||||
p=strstr(buf," neon");
|
||||
if(p!=NULL&&(p[5]==' '||p[5]=='\n'))flags|=OC_CPU_ARM_NEON;
|
||||
}
|
||||
if(memcmp(buf,"CPU architecture:",17)==0){
|
||||
int version;
|
||||
version=atoi(buf+17);
|
||||
if(version>=6)flags|=OC_CPU_ARM_MEDIA;
|
||||
}
|
||||
}
|
||||
fclose(fin);
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
#else
|
||||
/*The feature registers which can tell us what the processor supports are
|
||||
accessible in priveleged modes only, so we can't have a general user-space
|
||||
detection method like on x86.*/
|
||||
# error "Configured to use ARM asm but no CPU detection method available for " \
|
||||
"your platform. Reconfigure with --disable-asm (or send patches)."
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2010 *
|
||||
* by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
function:
|
||||
last mod: $Id: cpu.h 17344 2010-07-21 01:42:18Z tterribe $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#if !defined(_arm_armcpu_H)
|
||||
# define _arm_armcpu_H (1)
|
||||
#include "../internal.h"
|
||||
|
||||
/*"Parallel instructions" from ARM v6 and above.*/
|
||||
#define OC_CPU_ARM_MEDIA (1<<24)
|
||||
/*Flags chosen to match arch/arm/include/asm/hwcap.h in the Linux kernel.*/
|
||||
#define OC_CPU_ARM_EDSP (1<<7)
|
||||
#define OC_CPU_ARM_NEON (1<<12)
|
||||
|
||||
ogg_uint32_t oc_cpu_flags_get(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2010 *
|
||||
* by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function:
|
||||
last mod: $Id: x86state.c 17344 2010-07-21 01:42:18Z tterribe $
|
||||
|
||||
********************************************************************/
|
||||
#include "armenc.h"
|
||||
|
||||
#if defined(OC_ARM_ASM)
|
||||
|
||||
void oc_enc_accel_init_arm(oc_enc_ctx *_enc){
|
||||
ogg_uint32_t cpu_flags;
|
||||
cpu_flags=_enc->state.cpu_flags;
|
||||
oc_enc_accel_init_c(_enc);
|
||||
# if defined(OC_ENC_USE_VTABLE)
|
||||
/*TODO: Add ARMv4 functions here.*/
|
||||
# endif
|
||||
# if defined(OC_ARM_ASM_EDSP)
|
||||
if(cpu_flags&OC_CPU_ARM_EDSP){
|
||||
# if defined(OC_STATE_USE_VTABLE)
|
||||
/*TODO: Add EDSP functions here.*/
|
||||
# endif
|
||||
}
|
||||
# if defined(OC_ARM_ASM_MEDIA)
|
||||
if(cpu_flags&OC_CPU_ARM_MEDIA){
|
||||
# if defined(OC_STATE_USE_VTABLE)
|
||||
/*TODO: Add Media functions here.*/
|
||||
# endif
|
||||
}
|
||||
# if defined(OC_ARM_ASM_NEON)
|
||||
if(cpu_flags&OC_CPU_ARM_NEON){
|
||||
# if defined(OC_STATE_USE_VTABLE)
|
||||
_enc->opt_vtable.frag_satd=oc_enc_frag_satd_neon;
|
||||
_enc->opt_vtable.frag_satd2=oc_enc_frag_satd2_neon;
|
||||
_enc->opt_vtable.frag_intra_satd=oc_enc_frag_intra_satd_neon;
|
||||
_enc->opt_vtable.enquant_table_init=oc_enc_enquant_table_init_neon;
|
||||
_enc->opt_vtable.enquant_table_fixup=oc_enc_enquant_table_fixup_neon;
|
||||
_enc->opt_vtable.quantize=oc_enc_quantize_neon;
|
||||
# endif
|
||||
_enc->opt_data.enquant_table_size=128*sizeof(ogg_uint16_t);
|
||||
_enc->opt_data.enquant_table_alignment=16;
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,51 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2010 *
|
||||
* by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function:
|
||||
last mod: $Id: x86int.h 17344 2010-07-21 01:42:18Z tterribe $
|
||||
|
||||
********************************************************************/
|
||||
#if !defined(_arm_armenc_H)
|
||||
# define _arm_armenc_H (1)
|
||||
# include "armint.h"
|
||||
|
||||
# if defined(OC_ARM_ASM)
|
||||
# define oc_enc_accel_init oc_enc_accel_init_arm
|
||||
# define OC_ENC_USE_VTABLE (1)
|
||||
# endif
|
||||
|
||||
# include "../encint.h"
|
||||
|
||||
# if defined(OC_ARM_ASM)
|
||||
void oc_enc_accel_init_arm(oc_enc_ctx *_enc);
|
||||
|
||||
# if defined(OC_ARM_ASM_EDSP)
|
||||
# if defined(OC_ARM_ASM_MEDIA)
|
||||
# if defined(OC_ARM_ASM_NEON)
|
||||
unsigned oc_enc_frag_satd_neon(int *_dc,const unsigned char *_src,
|
||||
const unsigned char *_ref,int _ystride);
|
||||
unsigned oc_enc_frag_satd2_neon(int *_dc,const unsigned char *_src,
|
||||
const unsigned char *_ref1,const unsigned char *_ref2,int _ystride);
|
||||
unsigned oc_enc_frag_intra_satd_neon(int *_dc,
|
||||
const unsigned char *_src,int _ystride);
|
||||
|
||||
void oc_enc_enquant_table_init_neon(void *_enquant,
|
||||
const ogg_uint16_t _dequant[64]);
|
||||
void oc_enc_enquant_table_fixup_neon(void *_enquant[3][3][2],int _nqis);
|
||||
int oc_enc_quantize_neon(ogg_int16_t _qdct[64],const ogg_int16_t _dct[64],
|
||||
const ogg_uint16_t _dequant[64],const void *_enquant);
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,126 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2010 *
|
||||
* by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function:
|
||||
last mod: $Id: x86int.h 17344 2010-07-21 01:42:18Z tterribe $
|
||||
|
||||
********************************************************************/
|
||||
#if !defined(_arm_armint_H)
|
||||
# define _arm_armint_H (1)
|
||||
# include "../internal.h"
|
||||
|
||||
# if defined(OC_ARM_ASM)
|
||||
|
||||
# if defined(__ARMEB__)
|
||||
# error "Big-endian configurations are not supported by the ARM asm. " \
|
||||
"Reconfigure with --disable-asm or undefine OC_ARM_ASM."
|
||||
# endif
|
||||
|
||||
# define oc_state_accel_init oc_state_accel_init_arm
|
||||
/*This function is implemented entirely in asm, so it's helpful to pull out all
|
||||
of the things that depend on structure offsets.
|
||||
We reuse the function pointer with the wrong prototype, though.*/
|
||||
# define oc_state_loop_filter_frag_rows(_state,_bv,_refi,_pli, \
|
||||
_fragy0,_fragy_end) \
|
||||
((oc_loop_filter_frag_rows_arm_func) \
|
||||
(_state)->opt_vtable.state_loop_filter_frag_rows)( \
|
||||
(_state)->ref_frame_data[(_refi)],(_state)->ref_ystride[(_pli)], \
|
||||
(_bv), \
|
||||
(_state)->frags, \
|
||||
(_state)->fplanes[(_pli)].froffset \
|
||||
+(_fragy0)*(ptrdiff_t)(_state)->fplanes[(_pli)].nhfrags, \
|
||||
(_state)->fplanes[(_pli)].froffset \
|
||||
+(_fragy_end)*(ptrdiff_t)(_state)->fplanes[(_pli)].nhfrags, \
|
||||
(_state)->fplanes[(_pli)].froffset, \
|
||||
(_state)->fplanes[(_pli)].froffset+(_state)->fplanes[(_pli)].nfrags, \
|
||||
(_state)->frag_buf_offs, \
|
||||
(_state)->fplanes[(_pli)].nhfrags)
|
||||
/*For everything else the default vtable macros are fine.*/
|
||||
# define OC_STATE_USE_VTABLE (1)
|
||||
# endif
|
||||
|
||||
# include "../state.h"
|
||||
# include "armcpu.h"
|
||||
|
||||
# if defined(OC_ARM_ASM)
|
||||
typedef void (*oc_loop_filter_frag_rows_arm_func)(
|
||||
unsigned char *_ref_frame_data,int _ystride,signed char _bv[256],
|
||||
const oc_fragment *_frags,ptrdiff_t _fragi0,ptrdiff_t _fragi0_end,
|
||||
ptrdiff_t _fragi_top,ptrdiff_t _fragi_bot,
|
||||
const ptrdiff_t *_frag_buf_offs,int _nhfrags);
|
||||
|
||||
void oc_state_accel_init_arm(oc_theora_state *_state);
|
||||
void oc_frag_copy_list_arm(unsigned char *_dst_frame,
|
||||
const unsigned char *_src_frame,int _ystride,
|
||||
const ptrdiff_t *_fragis,ptrdiff_t _nfragis,const ptrdiff_t *_frag_buf_offs);
|
||||
void oc_frag_recon_intra_arm(unsigned char *_dst,int _ystride,
|
||||
const ogg_int16_t *_residue);
|
||||
void oc_frag_recon_inter_arm(unsigned char *_dst,const unsigned char *_src,
|
||||
int _ystride,const ogg_int16_t *_residue);
|
||||
void oc_frag_recon_inter2_arm(unsigned char *_dst,const unsigned char *_src1,
|
||||
const unsigned char *_src2,int _ystride,const ogg_int16_t *_residue);
|
||||
void oc_idct8x8_1_arm(ogg_int16_t _y[64],ogg_uint16_t _dc);
|
||||
void oc_idct8x8_arm(ogg_int16_t _y[64],ogg_int16_t _x[64],int _last_zzi);
|
||||
void oc_state_frag_recon_arm(const oc_theora_state *_state,ptrdiff_t _fragi,
|
||||
int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,ogg_uint16_t _dc_quant);
|
||||
void oc_loop_filter_frag_rows_arm(unsigned char *_ref_frame_data,
|
||||
int _ystride,signed char *_bv,const oc_fragment *_frags,ptrdiff_t _fragi0,
|
||||
ptrdiff_t _fragi0_end,ptrdiff_t _fragi_top,ptrdiff_t _fragi_bot,
|
||||
const ptrdiff_t *_frag_buf_offs,int _nhfrags);
|
||||
|
||||
# if defined(OC_ARM_ASM_EDSP)
|
||||
void oc_frag_copy_list_edsp(unsigned char *_dst_frame,
|
||||
const unsigned char *_src_frame,int _ystride,
|
||||
const ptrdiff_t *_fragis,ptrdiff_t _nfragis,const ptrdiff_t *_frag_buf_offs);
|
||||
|
||||
# if defined(OC_ARM_ASM_MEDIA)
|
||||
void oc_frag_recon_intra_v6(unsigned char *_dst,int _ystride,
|
||||
const ogg_int16_t *_residue);
|
||||
void oc_frag_recon_inter_v6(unsigned char *_dst,const unsigned char *_src,
|
||||
int _ystride,const ogg_int16_t *_residue);
|
||||
void oc_frag_recon_inter2_v6(unsigned char *_dst,const unsigned char *_src1,
|
||||
const unsigned char *_src2,int _ystride,const ogg_int16_t *_residue);
|
||||
void oc_idct8x8_1_v6(ogg_int16_t _y[64],ogg_uint16_t _dc);
|
||||
void oc_idct8x8_v6(ogg_int16_t _y[64],ogg_int16_t _x[64],int _last_zzi);
|
||||
void oc_state_frag_recon_v6(const oc_theora_state *_state,ptrdiff_t _fragi,
|
||||
int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,ogg_uint16_t _dc_quant);
|
||||
void oc_loop_filter_init_v6(signed char *_bv,int _flimit);
|
||||
void oc_loop_filter_frag_rows_v6(unsigned char *_ref_frame_data,
|
||||
int _ystride,signed char *_bv,const oc_fragment *_frags,ptrdiff_t _fragi0,
|
||||
ptrdiff_t _fragi0_end,ptrdiff_t _fragi_top,ptrdiff_t _fragi_bot,
|
||||
const ptrdiff_t *_frag_buf_offs,int _nhfrags);
|
||||
|
||||
# if defined(OC_ARM_ASM_NEON)
|
||||
void oc_frag_copy_list_neon(unsigned char *_dst_frame,
|
||||
const unsigned char *_src_frame,int _ystride,
|
||||
const ptrdiff_t *_fragis,ptrdiff_t _nfragis,const ptrdiff_t *_frag_buf_offs);
|
||||
void oc_frag_recon_intra_neon(unsigned char *_dst,int _ystride,
|
||||
const ogg_int16_t *_residue);
|
||||
void oc_frag_recon_inter_neon(unsigned char *_dst,const unsigned char *_src,
|
||||
int _ystride,const ogg_int16_t *_residue);
|
||||
void oc_frag_recon_inter2_neon(unsigned char *_dst,const unsigned char *_src1,
|
||||
const unsigned char *_src2,int _ystride,const ogg_int16_t *_residue);
|
||||
void oc_idct8x8_1_neon(ogg_int16_t _y[64],ogg_uint16_t _dc);
|
||||
void oc_idct8x8_neon(ogg_int16_t _y[64],ogg_int16_t _x[64],int _last_zzi);
|
||||
void oc_state_frag_recon_neon(const oc_theora_state *_state,ptrdiff_t _fragi,
|
||||
int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,ogg_uint16_t _dc_quant);
|
||||
void oc_loop_filter_init_neon(signed char *_bv,int _flimit);
|
||||
void oc_loop_filter_frag_rows_neon(unsigned char *_ref_frame_data,
|
||||
int _ystride,signed char *_bv,const oc_fragment *_frags,ptrdiff_t _fragi0,
|
||||
ptrdiff_t _fragi0_end,ptrdiff_t _fragi_top,ptrdiff_t _fragi_bot,
|
||||
const ptrdiff_t *_frag_buf_offs,int _nhfrags);
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,219 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2010 *
|
||||
* by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function:
|
||||
last mod: $Id: x86state.c 17344 2010-07-21 01:42:18Z tterribe $
|
||||
|
||||
********************************************************************/
|
||||
#include "armint.h"
|
||||
|
||||
#if defined(OC_ARM_ASM)
|
||||
|
||||
# if defined(OC_ARM_ASM_NEON)
|
||||
/*This table has been modified from OC_FZIG_ZAG by baking an 8x8 transpose into
|
||||
the destination.*/
|
||||
static const unsigned char OC_FZIG_ZAG_NEON[128]={
|
||||
0, 8, 1, 2, 9,16,24,17,
|
||||
10, 3, 4,11,18,25,32,40,
|
||||
33,26,19,12, 5, 6,13,20,
|
||||
27,34,41,48,56,49,42,35,
|
||||
28,21,14, 7,15,22,29,36,
|
||||
43,50,57,58,51,44,37,30,
|
||||
23,31,38,45,52,59,60,53,
|
||||
46,39,47,54,61,62,55,63,
|
||||
64,64,64,64,64,64,64,64,
|
||||
64,64,64,64,64,64,64,64,
|
||||
64,64,64,64,64,64,64,64,
|
||||
64,64,64,64,64,64,64,64,
|
||||
64,64,64,64,64,64,64,64,
|
||||
64,64,64,64,64,64,64,64,
|
||||
64,64,64,64,64,64,64,64,
|
||||
64,64,64,64,64,64,64,64
|
||||
};
|
||||
# endif
|
||||
|
||||
void oc_state_accel_init_arm(oc_theora_state *_state){
|
||||
oc_state_accel_init_c(_state);
|
||||
_state->cpu_flags=oc_cpu_flags_get();
|
||||
# if defined(OC_STATE_USE_VTABLE)
|
||||
_state->opt_vtable.frag_copy_list=oc_frag_copy_list_arm;
|
||||
_state->opt_vtable.frag_recon_intra=oc_frag_recon_intra_arm;
|
||||
_state->opt_vtable.frag_recon_inter=oc_frag_recon_inter_arm;
|
||||
_state->opt_vtable.frag_recon_inter2=oc_frag_recon_inter2_arm;
|
||||
_state->opt_vtable.idct8x8=oc_idct8x8_arm;
|
||||
_state->opt_vtable.state_frag_recon=oc_state_frag_recon_arm;
|
||||
/*Note: We _must_ set this function pointer, because the macro in armint.h
|
||||
calls it with different arguments, so the C version will segfault.*/
|
||||
_state->opt_vtable.state_loop_filter_frag_rows=
|
||||
(oc_state_loop_filter_frag_rows_func)oc_loop_filter_frag_rows_arm;
|
||||
# endif
|
||||
# if defined(OC_ARM_ASM_EDSP)
|
||||
if(_state->cpu_flags&OC_CPU_ARM_EDSP){
|
||||
# if defined(OC_STATE_USE_VTABLE)
|
||||
_state->opt_vtable.frag_copy_list=oc_frag_copy_list_edsp;
|
||||
# endif
|
||||
}
|
||||
# if defined(OC_ARM_ASM_MEDIA)
|
||||
if(_state->cpu_flags&OC_CPU_ARM_MEDIA){
|
||||
# if defined(OC_STATE_USE_VTABLE)
|
||||
_state->opt_vtable.frag_recon_intra=oc_frag_recon_intra_v6;
|
||||
_state->opt_vtable.frag_recon_inter=oc_frag_recon_inter_v6;
|
||||
_state->opt_vtable.frag_recon_inter2=oc_frag_recon_inter2_v6;
|
||||
_state->opt_vtable.idct8x8=oc_idct8x8_v6;
|
||||
_state->opt_vtable.state_frag_recon=oc_state_frag_recon_v6;
|
||||
_state->opt_vtable.loop_filter_init=oc_loop_filter_init_v6;
|
||||
_state->opt_vtable.state_loop_filter_frag_rows=
|
||||
(oc_state_loop_filter_frag_rows_func)oc_loop_filter_frag_rows_v6;
|
||||
# endif
|
||||
}
|
||||
# if defined(OC_ARM_ASM_NEON)
|
||||
if(_state->cpu_flags&OC_CPU_ARM_NEON){
|
||||
# if defined(OC_STATE_USE_VTABLE)
|
||||
_state->opt_vtable.frag_copy_list=oc_frag_copy_list_neon;
|
||||
_state->opt_vtable.frag_recon_intra=oc_frag_recon_intra_neon;
|
||||
_state->opt_vtable.frag_recon_inter=oc_frag_recon_inter_neon;
|
||||
_state->opt_vtable.frag_recon_inter2=oc_frag_recon_inter2_neon;
|
||||
_state->opt_vtable.state_frag_recon=oc_state_frag_recon_neon;
|
||||
_state->opt_vtable.loop_filter_init=oc_loop_filter_init_neon;
|
||||
_state->opt_vtable.state_loop_filter_frag_rows=
|
||||
(oc_state_loop_filter_frag_rows_func)oc_loop_filter_frag_rows_neon;
|
||||
_state->opt_vtable.idct8x8=oc_idct8x8_neon;
|
||||
# endif
|
||||
_state->opt_data.dct_fzig_zag=OC_FZIG_ZAG_NEON;
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
|
||||
void oc_state_frag_recon_arm(const oc_theora_state *_state,ptrdiff_t _fragi,
|
||||
int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,ogg_uint16_t _dc_quant){
|
||||
unsigned char *dst;
|
||||
ptrdiff_t frag_buf_off;
|
||||
int ystride;
|
||||
int refi;
|
||||
/*Apply the inverse transform.*/
|
||||
/*Special case only having a DC component.*/
|
||||
if(_last_zzi<2){
|
||||
ogg_uint16_t p;
|
||||
/*We round this dequant product (and not any of the others) because there's
|
||||
no iDCT rounding.*/
|
||||
p=(ogg_uint16_t)(_dct_coeffs[0]*(ogg_int32_t)_dc_quant+15>>5);
|
||||
oc_idct8x8_1_arm(_dct_coeffs+64,p);
|
||||
}
|
||||
else{
|
||||
/*First, dequantize the DC coefficient.*/
|
||||
_dct_coeffs[0]=(ogg_int16_t)(_dct_coeffs[0]*(int)_dc_quant);
|
||||
oc_idct8x8_arm(_dct_coeffs+64,_dct_coeffs,_last_zzi);
|
||||
}
|
||||
/*Fill in the target buffer.*/
|
||||
frag_buf_off=_state->frag_buf_offs[_fragi];
|
||||
refi=_state->frags[_fragi].refi;
|
||||
ystride=_state->ref_ystride[_pli];
|
||||
dst=_state->ref_frame_data[OC_FRAME_SELF]+frag_buf_off;
|
||||
if(refi==OC_FRAME_SELF)oc_frag_recon_intra_arm(dst,ystride,_dct_coeffs+64);
|
||||
else{
|
||||
const unsigned char *ref;
|
||||
int mvoffsets[2];
|
||||
ref=_state->ref_frame_data[refi]+frag_buf_off;
|
||||
if(oc_state_get_mv_offsets(_state,mvoffsets,_pli,
|
||||
_state->frag_mvs[_fragi])>1){
|
||||
oc_frag_recon_inter2_arm(dst,ref+mvoffsets[0],ref+mvoffsets[1],ystride,
|
||||
_dct_coeffs+64);
|
||||
}
|
||||
else oc_frag_recon_inter_arm(dst,ref+mvoffsets[0],ystride,_dct_coeffs+64);
|
||||
}
|
||||
}
|
||||
|
||||
# if defined(OC_ARM_ASM_MEDIA)
|
||||
void oc_state_frag_recon_v6(const oc_theora_state *_state,ptrdiff_t _fragi,
|
||||
int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,ogg_uint16_t _dc_quant){
|
||||
unsigned char *dst;
|
||||
ptrdiff_t frag_buf_off;
|
||||
int ystride;
|
||||
int refi;
|
||||
/*Apply the inverse transform.*/
|
||||
/*Special case only having a DC component.*/
|
||||
if(_last_zzi<2){
|
||||
ogg_uint16_t p;
|
||||
/*We round this dequant product (and not any of the others) because there's
|
||||
no iDCT rounding.*/
|
||||
p=(ogg_uint16_t)(_dct_coeffs[0]*(ogg_int32_t)_dc_quant+15>>5);
|
||||
oc_idct8x8_1_v6(_dct_coeffs+64,p);
|
||||
}
|
||||
else{
|
||||
/*First, dequantize the DC coefficient.*/
|
||||
_dct_coeffs[0]=(ogg_int16_t)(_dct_coeffs[0]*(int)_dc_quant);
|
||||
oc_idct8x8_v6(_dct_coeffs+64,_dct_coeffs,_last_zzi);
|
||||
}
|
||||
/*Fill in the target buffer.*/
|
||||
frag_buf_off=_state->frag_buf_offs[_fragi];
|
||||
refi=_state->frags[_fragi].refi;
|
||||
ystride=_state->ref_ystride[_pli];
|
||||
dst=_state->ref_frame_data[OC_FRAME_SELF]+frag_buf_off;
|
||||
if(refi==OC_FRAME_SELF)oc_frag_recon_intra_v6(dst,ystride,_dct_coeffs+64);
|
||||
else{
|
||||
const unsigned char *ref;
|
||||
int mvoffsets[2];
|
||||
ref=_state->ref_frame_data[refi]+frag_buf_off;
|
||||
if(oc_state_get_mv_offsets(_state,mvoffsets,_pli,
|
||||
_state->frag_mvs[_fragi])>1){
|
||||
oc_frag_recon_inter2_v6(dst,ref+mvoffsets[0],ref+mvoffsets[1],ystride,
|
||||
_dct_coeffs+64);
|
||||
}
|
||||
else oc_frag_recon_inter_v6(dst,ref+mvoffsets[0],ystride,_dct_coeffs+64);
|
||||
}
|
||||
}
|
||||
|
||||
# if defined(OC_ARM_ASM_NEON)
|
||||
void oc_state_frag_recon_neon(const oc_theora_state *_state,ptrdiff_t _fragi,
|
||||
int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,ogg_uint16_t _dc_quant){
|
||||
unsigned char *dst;
|
||||
ptrdiff_t frag_buf_off;
|
||||
int ystride;
|
||||
int refi;
|
||||
/*Apply the inverse transform.*/
|
||||
/*Special case only having a DC component.*/
|
||||
if(_last_zzi<2){
|
||||
ogg_uint16_t p;
|
||||
/*We round this dequant product (and not any of the others) because there's
|
||||
no iDCT rounding.*/
|
||||
p=(ogg_uint16_t)(_dct_coeffs[0]*(ogg_int32_t)_dc_quant+15>>5);
|
||||
oc_idct8x8_1_neon(_dct_coeffs+64,p);
|
||||
}
|
||||
else{
|
||||
/*First, dequantize the DC coefficient.*/
|
||||
_dct_coeffs[0]=(ogg_int16_t)(_dct_coeffs[0]*(int)_dc_quant);
|
||||
oc_idct8x8_neon(_dct_coeffs+64,_dct_coeffs,_last_zzi);
|
||||
}
|
||||
/*Fill in the target buffer.*/
|
||||
frag_buf_off=_state->frag_buf_offs[_fragi];
|
||||
refi=_state->frags[_fragi].refi;
|
||||
ystride=_state->ref_ystride[_pli];
|
||||
dst=_state->ref_frame_data[OC_FRAME_SELF]+frag_buf_off;
|
||||
if(refi==OC_FRAME_SELF)oc_frag_recon_intra_neon(dst,ystride,_dct_coeffs+64);
|
||||
else{
|
||||
const unsigned char *ref;
|
||||
int mvoffsets[2];
|
||||
ref=_state->ref_frame_data[refi]+frag_buf_off;
|
||||
if(oc_state_get_mv_offsets(_state,mvoffsets,_pli,
|
||||
_state->frag_mvs[_fragi])>1){
|
||||
oc_frag_recon_inter2_neon(dst,ref+mvoffsets[0],ref+mvoffsets[1],ystride,
|
||||
_dct_coeffs+64);
|
||||
}
|
||||
else oc_frag_recon_inter_neon(dst,ref+mvoffsets[0],ystride,_dct_coeffs+64);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user