[xiph-commits] r12748 - in experimental/j/theora-mashup/lib: . dec
dec/x86 enc
j at svn.xiph.org
j at svn.xiph.org
Tue Mar 13 04:25:30 PDT 2007
Author: j
Date: 2007-03-13 04:25:16 -0700 (Tue, 13 Mar 2007)
New Revision: 12748
Added:
experimental/j/theora-mashup/lib/cpu.c
experimental/j/theora-mashup/lib/cpu.h
experimental/j/theora-mashup/lib/enc/encoder_idct.c
experimental/j/theora-mashup/lib/internal.h
Removed:
experimental/j/theora-mashup/lib/dec/internal.h
experimental/j/theora-mashup/lib/dec/x86/cpu.c
experimental/j/theora-mashup/lib/dec/x86/cpu.h
experimental/j/theora-mashup/lib/enc/enccpu.c
experimental/j/theora-mashup/lib/enc/enccpu.h
experimental/j/theora-mashup/lib/enc/encidct.c
Modified:
experimental/j/theora-mashup/lib/Makefile.am
experimental/j/theora-mashup/lib/dec/x86/mmxfrag.c
experimental/j/theora-mashup/lib/dec/x86/mmxidct.c
experimental/j/theora-mashup/lib/dec/x86/mmxstate.c
experimental/j/theora-mashup/lib/dec/x86/x86int.h
experimental/j/theora-mashup/lib/dec/x86/x86state.c
experimental/j/theora-mashup/lib/enc/dct.c
experimental/j/theora-mashup/lib/enc/dsp.c
experimental/j/theora-mashup/lib/enc/reconstruct.c
Log:
- one cpu feature detection function should be enough
- rename encidct.c to encoder_idct.c
Modified: experimental/j/theora-mashup/lib/Makefile.am
===================================================================
--- experimental/j/theora-mashup/lib/Makefile.am 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/Makefile.am 2007-03-13 11:25:16 UTC (rev 12748)
@@ -1,4 +1,4 @@
-INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib/dec -I$(top_srcdir)/lib/enc
+INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib -I$(top_srcdir)/lib/dec -I$(top_srcdir)/lib/enc
EXTRA_DIST = Version_script.in \
enc/x86_32/dsp_mmx.c \
@@ -25,6 +25,7 @@
encoder_sources = \
enc/dct_encode.c \
enc/encode.c \
+ enc/encoder_idct.c \
enc/encoder_toplevel.c \
enc/blockmap.c \
enc/common.c \
@@ -34,7 +35,6 @@
enc/frarray.c \
enc/frinit.c \
enc/huffman.c \
- enc/encidct.c \
enc/mcomp.c \
enc/misc_common.c \
enc/pb.c \
@@ -42,7 +42,6 @@
enc/encquant.c \
enc/reconstruct.c \
enc/scan.c \
- enc/enccpu.c \
enc/dsp.c
if CPU_x86_64
@@ -80,7 +79,6 @@
if CPU_x86_64
decoder_x86_sources = \
- dec/x86/cpu.c \
dec/x86/mmxidct.c \
dec/x86/mmxfrag.c \
dec/x86/mmxstate.c \
@@ -88,7 +86,6 @@
else
if CPU_x86_32
decoder_x86_sources = \
- dec/x86/cpu.c \
dec/x86/mmxidct.c \
dec/x86/mmxfrag.c \
dec/x86/mmxstate.c \
@@ -97,12 +94,15 @@
endif
libtheora_la_SOURCES = \
+ cpu.c \
$(decoder_x86_sources) \
$(decoder_sources) \
$(encoder_arch_sources) \
$(encoder_sources)
noinst_HEADERS = \
+ cpu.h \
+ internal.h \
enc/block_inline.h \
enc/codec_internal.h \
enc/encoder_lookup.h \
@@ -111,7 +111,6 @@
enc/pp.h \
enc/quant_lookup.h \
enc/toplevel_lookup.h \
- enc/enccpu.h \
enc/dsp.h \
dec/dct.h \
dec/decint.h \
@@ -124,11 +123,9 @@
dec/huffenc.h \
dec/huffman.h \
dec/idct.h \
- dec/internal.h \
dec/ocintrin.h \
dec/psych.h \
dec/quant.h \
- dec/x86/cpu.h \
dec/x86/x86int.h
Copied: experimental/j/theora-mashup/lib/cpu.c (from rev 12737, experimental/j/theora-mashup/lib/dec/x86/cpu.c)
===================================================================
--- experimental/j/theora-mashup/lib/dec/x86/cpu.c 2007-03-12 20:01:08 UTC (rev 12737)
+++ experimental/j/theora-mashup/lib/cpu.c 2007-03-13 11:25:16 UTC (rev 12748)
@@ -0,0 +1,114 @@
+/********************************************************************
+ * *
+ * 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-2003 *
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
+ * *
+ ********************************************************************/
+/*CPU capability detection for x86 processors.
+ Originally written by Rudolf Marek.*/
+
+#include "cpu.h"
+
+#if defined(USE_ASM)
+
+ogg_uint32_t oc_cpu_flags_get(void){
+ ogg_uint32_t eax;
+ ogg_uint32_t ebx;
+ ogg_uint32_t ecx;
+ ogg_uint32_t edx;
+ ogg_uint32_t flags;
+#if (defined(__amd64__) || defined(__x86_64__))
+# define cpuid(_op,_eax,_ebx,_ecx,_edx) \
+ __asm__ __volatile__( \
+ "push %%rbx\n\t" \
+ "cpuid\n\t" \
+ "movl %%ebx,%1\n\t" \
+ "pop %%rbx\n\t" \
+ :"=a" (_eax), \
+ "=r" (_ebx), \
+ "=c" (_ecx), \
+ "=d" (_edx) \
+ :"a" (_op) \
+ :"cc" \
+ )
+#else
+# define cpuid(_op,_eax,_ebx,_ecx,_edx) \
+ __asm__ __volatile__( \
+ "pushl %%ebx\n\t" \
+ "cpuid\n\t" \
+ "movl %%ebx,%1\n\t" \
+ "popl %%ebx\n\t" \
+ :"=a" (_eax), \
+ "=r" (_ebx), \
+ "=c" (_ecx), \
+ "=d" (_edx) \
+ :"a" (_op) \
+ :"cc" \
+ )
+ __asm__ __volatile__(
+ "pushfl\n\t"
+ "pushfl\n\t"
+ "popl %0\n\t"
+ "movl %0,%1\n\t"
+ "xorl $0x200000,%0\n\t"
+ "pushl %0\n\t"
+ "popfl\n\t"
+ "pushfl\n\t"
+ "popl %0\n\t"
+ "popfl\n\t"
+ :"=r" (eax),
+ "=r" (ebx)
+ :
+ :"cc"
+ );
+ /*No cpuid.*/
+ if(eax==ebx)return 0;
+#endif
+ cpuid(0,eax,ebx,ecx,edx);
+ if(ebx==0x756e6547&&edx==0x49656e69&&ecx==0x6c65746e){
+ /*Intel:*/
+inteltest:
+ cpuid(1,eax,ebx,ecx,edx);
+ if((edx&0x00800000)==0)return 0;
+ flags=OC_CPU_X86_MMX;
+ if(edx&0x02000000)flags|=OC_CPU_X86_MMXEXT|OC_CPU_X86_SSE;
+ if(edx&0x04000000)flags|=OC_CPU_X86_SSE2;
+ }
+ else if(ebx==0x68747541&&edx==0x69746e65&&ecx==0x444d4163){
+ /*AMD:*/
+ cpuid(0x80000000,eax,ebx,ecx,edx);
+ if(eax<0x80000001)goto inteltest;
+ cpuid(0x80000001,eax,ebx,ecx,edx);
+ if((edx&0x00800000)==0)return 0;
+ flags=OC_CPU_X86_MMX;
+ if(edx&0x80000000)flags|=OC_CPU_X86_3DNOW;
+ if(edx&0x40000000)flags|=OC_CPU_X86_3DNOWEXT;
+ if(edx&0x00400000)flags|=OC_CPU_X86_MMXEXT;
+ }
+ else{
+ /*Implement me.*/
+ flags=0;
+ }
+
+#ifdef DEBUG
+ if (flags) {
+ TH_DEBUG("vectorized instruction sets supported:");
+ if (flags & OC_CPU_X86_MMX) TH_DEBUG(" mmx");
+ if (flags & OC_CPU_X86_MMXEXT) TH_DEBUG(" mmxext");
+ if (flags & OC_CPU_X86_SSE) TH_DEBUG(" sse");
+ if (flags & OC_CPU_X86_SSE2) TH_DEBUG(" sse2");
+ if (flags & OC_CPU_X86_3DNOW) TH_DEBUG(" 3dnow");
+ if (flags & OC_CPU_X86_3DNOWEXT) TH_DEBUG(" 3dnowext");
+ TH_DEBUG("\n");
+ }
+#endif
+
+ return flags;
+}
+
+#endif
Copied: experimental/j/theora-mashup/lib/cpu.h (from rev 12737, experimental/j/theora-mashup/lib/dec/x86/cpu.h)
===================================================================
--- experimental/j/theora-mashup/lib/dec/x86/cpu.h 2007-03-12 20:01:08 UTC (rev 12737)
+++ experimental/j/theora-mashup/lib/cpu.h 2007-03-13 11:25:16 UTC (rev 12748)
@@ -0,0 +1,27 @@
+/********************************************************************
+ * *
+ * 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-2003 *
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
+ * *
+ ********************************************************************
+*/
+#if !defined(_x86_cpu_H)
+# define _x86_cpu_H (1)
+#include "internal.h"
+#include "codec_internal.h"
+
+#define OC_CPU_X86_MMX (1<<0)
+#define OC_CPU_X86_3DNOW (1<<1)
+#define OC_CPU_X86_3DNOWEXT (1<<2)
+#define OC_CPU_X86_MMXEXT (1<<3)
+#define OC_CPU_X86_SSE (1<<4)
+#define OC_CPU_X86_SSE2 (1<<5)
+
+ogg_uint32_t oc_cpu_flags_get(void);
+
+#endif
Deleted: experimental/j/theora-mashup/lib/dec/internal.h
===================================================================
--- experimental/j/theora-mashup/lib/dec/internal.h 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/dec/internal.h 2007-03-13 11:25:16 UTC (rev 12748)
@@ -1,435 +0,0 @@
-#if !defined(_internal_H)
-# define _internal_H (1)
-# include <stdlib.h>
-# if defined(HAVE_CONFIG_H)
-# include <config.h>
-# endif
-# include "theora/codec.h"
-# include "theora/theora.h"
-# include "ocintrin.h"
-# include "huffman.h"
-# include "quant.h"
-
-/*Thank you Microsoft, I know the order of operations.*/
-#pragma warning(disable:4554)
-
-/*This library's version.*/
-# define OC_VENDOR_STRING "Xiph.Org libTheora I 20060526 3 2 0"
-
-/*Theora bitstream version.*/
-# define TH_VERSION_MAJOR (3)
-# define TH_VERSION_MINOR (2)
-# define TH_VERSION_SUB (0)
-
-/*A keyframe.*/
-#define OC_INTRA_FRAME (0)
-/*A predicted frame.*/
-#define OC_INTER_FRAME (1)
-/*A frame of unknown type (frame type decision has not yet been made).*/
-#define OC_UNKWN_FRAME (-1)
-
-/*The amount of padding to add to the reconstructed frame buffers on all
- sides.
- This is used to allow unrestricted motion vectors without special casing.
- This must be a multiple of 2.*/
-#define OC_UMV_PADDING (16)
-
-/*Frame classification indices.*/
-/*The previous golden frame.*/
-#define OC_FRAME_GOLD (0)
-/*The previous frame.*/
-#define OC_FRAME_PREV (1)
-/*The current frame.*/
-#define OC_FRAME_SELF (2)
-
-/*The input or output buffer.*/
-#define OC_FRAME_IO (3)
-
-/*Macroblock modes.*/
-/*Macro block is invalid: It is never coded.*/
-#define OC_MODE_INVALID (-1)
-
-/*Encoded with no motion compensated prediction.*/
-#define OC_MODE_INTRA (0)
-/*Encoded difference from the same macro block in the previous frame.*/
-#define OC_MODE_INTER_NOMV (1)
-/*Encoded difference from the previous frame offset by the given motion
- vector.*/
-#define OC_MODE_INTER_MV (2)
-/*Encoded difference from the previous frame offset by the last coded motion
- vector.*/
-#define OC_MODE_INTER_MV_LAST (3)
-/*Encoded difference from the previous frame offset by the second to last
- coded motion vector.*/
-#define OC_MODE_INTER_MV_LAST2 (4)
-/*Encoded difference from the previous frame offset by the individual motion
- vectors given for each block.*/
-#define OC_MODE_INTER_MV_FOUR (5)
-/*Encoded difference from the same macro block in the previous golden frame.*/
-#define OC_MODE_GOLDEN_NOMV (6)
-/*Encoded difference from the previous golden frame offset by the given motion
- vector.*/
-#define OC_MODE_GOLDEN_MV (7)
-/*The number of (coded) modes.*/
-#define OC_NMODES (8)
-
-/*Macro block is not coded.*/
-#define OC_MODE_NOT_CODED (8)
-
-/*Predictor bit flags.*/
-/*Left.*/
-#define OC_PL (1)
-/*Upper-left.*/
-#define OC_PUL (2)
-/*Up.*/
-#define OC_PU (4)
-/*Upper-right.*/
-#define OC_PUR (8)
-
-/*Constants for the packet state machine common between encoder and decoder.*/
-
-/*Next packet to emit/read: Codec info header.*/
-#define OC_PACKET_INFO_HDR (-3)
-/*Next packet to emit/read: Comment header.*/
-#define OC_PACKET_COMMENT_HDR (-2)
-/*Next packet to emit/read: Codec setup header.*/
-#define OC_PACKET_SETUP_HDR (-1)
-/*No more packets to emit/read.*/
-#define OC_PACKET_DONE (INT_MAX)
-
-
-
-typedef struct oc_theora_state oc_theora_state;
-
-
-
-/*A map from a super block to fragment numbers.*/
-typedef int oc_sb_map[4][4];
-/*A map from a macro block to fragment numbers.*/
-typedef int oc_mb_map[3][4];
-
-
-
-/*Super block information.
- Super blocks are 32x32 segments of pixels in a single color plane indexed
- in image order.
- Internally, super blocks are broken up into four quadrants, each of which
- contains a 2x2 pattern of blocks, each of which is an 8x8 block of pixels.
- Quadrants, and the blocks within them, are indexed in a special order called
- a "Hilbert curve" within the super block.
-
- In order to differentiate between the Hilbert-curve indexing strategy and
- the regular image order indexing strategy, blocks indexed in image order
- are called "fragments".
- Fragments are indexed in image order, left to right, then bottom to top,
- from Y plane to Cb plane to Cr plane.*/
-typedef struct{
- unsigned coded_fully:1;
- unsigned coded_partially:1;
- unsigned quad_valid:4;
- oc_sb_map map;
-}oc_sb;
-
-
-
-/*Macro block information.
- The co-located fragments in all image planes corresponding to the location of
- a single luma plane super block quadrant forms a macro block.
- Thus there is only a single set of macro blocks for all planes, which
- contains between 6 and 12 fragments, depending on the pixel format.
- Therefore macro block information is kept in a separate array from super
- blocks, to avoid unused space in the other planes.*/
-typedef struct{
- /*The current macro block mode.
- A negative number indicates the macro block lies entirely outside the
- coded frame.*/
- int mode;
- /*The X location of the macro block's upper-left hand pixel.*/
- int x;
- /*The Y location of the macro block's upper-right hand pixel.*/
- int y;
- /*The fragments that belong to this macro block in each color plane.
- Fragments are stored in image order (left to right then top to bottom).
- When chroma components are decimated, the extra fragments have an index of
- -1.*/
- oc_mb_map map;
-}oc_mb;
-
-
-
-/*Information about a fragment which intersects the border of the displayable
- region.
- This marks which pixels belong to the displayable region, and is used to
- ensure that pixels outside of this region are never referenced.
- This allows applications to pass in buffers that are really the size of the
- displayable region without causing a seg fault.*/
-typedef struct{
- /*A bit mask marking which pixels are in the displayable region.
- Pixel (x,y) corresponds to bit (y<<3|x).*/
- ogg_int64_t mask;
- /*The number of pixels in the displayable region.
- This is always positive, and always less than 64.*/
- int npixels;
-}oc_border_info;
-
-
-
-/*Fragment information.*/
-typedef struct{
- /*A flag indicating whether or not this fragment is coded.*/
- unsigned coded:1;
- /*A flag indicating that all of this fragment lies outside the displayable
- region of the frame.
- Note the contrast with an invalid macro block, which is outside the coded
- frame, not just the displayable one.*/
- unsigned invalid:1;
- /*The quality index used for this fragment's AC coefficients.*/
- unsigned qi:6;
- /*The mode of the macroblock this fragment belongs to.*/
- int mbmode:8;
- /*The prediction-corrected DC component.*/
- int dc:16;
- /*A pointer to the portion of an image covered by this fragment in several
- images.
- The first three are reconstructed frame buffers, while the last is the
- input image buffer.
- The appropriate stride value is determined by the color plane the fragment
- belongs in.*/
- unsigned char *buffer[4];
- /*Information for fragments which lie partially outside the displayable
- region.
- For fragments completely inside or outside this region, this is NULL.*/
- oc_border_info *border;
- /*The motion vector used for this fragment.*/
- char mv[2];
-}oc_fragment;
-
-
-
-/*A description of each fragment plane.*/
-typedef struct{
- /*The number of fragments in the horizontal direction.*/
- int nhfrags;
- /*The number of fragments in the vertical direction.*/
- int nvfrags;
- /*The offset of the first fragment in the plane.*/
- int froffset;
- /*The total number of fragments in the plane.*/
- int nfrags;
- /*The number of super blocks in the horizontal direction.*/
- int nhsbs;
- /*The number of super blocks in the vertical direction.*/
- int nvsbs;
- /*The offset of the first super block in the plane.*/
- int sboffset;
- /*The total number of super blocks in the plane.*/
- int nsbs;
-}oc_fragment_plane;
-
-
-
-/*The shared (encoder and decoder) functions that have accelerated variants.*/
-typedef struct{
- void (*frag_recon_intra)(unsigned char *_dst,int _dst_ystride,
- const ogg_int16_t *_residue);
- void (*frag_recon_inter)(unsigned char *_dst,int _dst_ystride,
- const unsigned char *_src,int _src_ystride,const ogg_int16_t *_residue);
- void (*frag_recon_inter2)(unsigned char *_dst,int _dst_ystride,
- const unsigned char *_src1,int _src1_ystride,const unsigned char *_src2,
- int _src2_ystride,const ogg_int16_t *_residue);
- void (*state_frag_copy)(const oc_theora_state *_state,
- const int *_fragis,int _nfragis,int _dst_frame,int _src_frame,int _pli);
- void (*state_frag_recon)(oc_theora_state *_state,const oc_fragment *_frag,
- int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,int _ncoefs,
- ogg_uint16_t _dc_iquant,const ogg_uint16_t _ac_iquant[64]);
- void (*restore_fpu)(void);
-}oc_base_opt_vtable;
-
-
-
-/*Common state information between the encoder and decoder.*/
-struct oc_theora_state{
- /*The stream information.*/
- th_info info;
- /*Table for shared accelerated functions.*/
- oc_base_opt_vtable opt_vtable;
- /*CPU flags to detect the presence of extended instruction sets.*/
- ogg_uint32_t cpu_flags;
- /*The fragment plane descriptions.*/
- oc_fragment_plane fplanes[3];
- /*The total number of fragments in a single frame.*/
- int nfrags;
- /*The list of fragments, indexed in image order.*/
- oc_fragment *frags;
- /*The total number of super blocks in a single frame.*/
- int nsbs;
- /*The list of super blocks, indexed in image order.*/
- oc_sb *sbs;
- /*The number of macro blocks in the X direction.*/
- int nhmbs;
- /*The number of macro blocks in the Y direction.*/
- int nvmbs;
- /*The total number of macro blocks.*/
- int nmbs;
- /*The list of macro blocks, indexed in super block order.
- That is, the macro block corresponding to the macro block mbi in (luma
- plane) super block sbi is (sbi<<2|mbi).*/
- oc_mb *mbs;
- /*The list of coded fragments, in coded order.*/
- int *coded_fragis;
- /*The number of coded fragments in each plane.*/
- int ncoded_fragis[3];
- /*The list of uncoded fragments.
- This just past the end of the list, which is in reverse order, and
- uses the same block of allocated storage as the coded_fragis list.*/
- int *uncoded_fragis;
- /*The number of uncoded fragments in each plane.*/
- int nuncoded_fragis[3];
- /*The list of coded macro blocks in the Y plane, in coded order.*/
- int *coded_mbis;
- /*The number of coded macro blocks in the Y plane.*/
- int ncoded_mbis;
- /*A copy of the image data used to fill the input pointers in each fragment.
- If the data pointers or strides change, these input pointers must be
- re-populated.*/
- th_ycbcr_buffer input;
- /*The number of unique border patterns.*/
- int nborders;
- /*The storage for the border info for all border fragments.
- This data is pointed to from the appropriate fragments.*/
- oc_border_info borders[16];
- /*The index of the buffers being used for each OC_FRAME_* reference frame.*/
- int ref_frame_idx[3];
- /*The actual buffers used for the previously decoded frames.*/
- th_ycbcr_buffer ref_frame_bufs[3];
- /*The storage for the reference frame buffers.*/
- unsigned char *ref_frame_data;
- /*The frame number of the last keyframe.*/
- ogg_int64_t keyframe_num;
- /*The frame number of the current frame.*/
- ogg_int64_t curframe_num;
- /*The granpos of the current frame.*/
- ogg_int64_t granpos;
- /*The type of the current frame.*/
- int frame_type;
- /*The quality indices of the current frame.*/
- int qis[3];
- /*The number of quality indices used in the current frame.*/
- int nqis;
- /*The dequantization tables.*/
- oc_quant_table *dequant_tables[2][3];
- oc_quant_tables dequant_table_data[2][3];
- /*Loop filter strength parameters.*/
- unsigned char loop_filter_limits[64];
-};
-
-
-
-/*The function type used to fill in the chroma plane motion vectors for a
- macro block when 4 different motion vectors are specified in the luma
- plane.
- _cbmvs: The chroma block-level motion vectors to fill in.
- _lmbmv: The luma macro-block level motion vector to fill in for use in
- prediction.
- _lbmvs: The luma block-level motion vectors.*/
-typedef void (*oc_set_chroma_mvs_func)(char _cbmvs[4][2],
- const char _lbmvs[4][2]);
-
-
-
-/*A map from the index in the zig zag scan to the coefficient number in a
- block.
- The extra 64 entries send out of bounds indexes to index 64.
- This is used to safely ignore invalid zero runs when decoding
- coefficients.*/
-extern const int OC_FZIG_ZAG[128];
-/*A map from the coefficient number in a block to its index in the zig zag
- scan.*/
-extern const int OC_IZIG_ZAG[64];
-/*The predictor frame to use for each macro block mode.*/
-extern const int OC_FRAME_FOR_MODE[OC_NMODES];
-/*A map from physical macro block ordering to bitstream macro block
- ordering within a super block.*/
-extern const int OC_MB_MAP[2][2];
-/*A list of the indices in the oc_mb.map array that can be valid for each of
- the various chroma decimation types.*/
-extern const int OC_MB_MAP_IDXS[TH_PF_NFORMATS][12];
-/*The number of indices in the oc_mb.map array that can be valid for each of
- the various chroma decimation types.*/
-extern const int OC_MB_MAP_NIDXS[TH_PF_NFORMATS];
-/*A table of functions used to fill in the Cb,Cr plane motion vectors for a
- macro block when 4 different motion vectors are specified in the luma
- plane.*/
-extern const oc_set_chroma_mvs_func OC_SET_CHROMA_MVS_TABLE[TH_PF_NFORMATS];
-
-
-
-int oc_ilog(unsigned _v);
-void **oc_malloc_2d(size_t _height,size_t _width,size_t _sz);
-void **oc_calloc_2d(size_t _height,size_t _width,size_t _sz);
-void oc_free_2d(void **_ptr);
-
-void oc_ycbcr_buffer_flip(th_ycbcr_buffer _dst,
- const th_ycbcr_buffer _src);
-
-int oc_dct_token_skip(int _token,int _extra_bits);
-
-int oc_frag_pred_dc(const oc_fragment *_frag,
- const oc_fragment_plane *_fplane,int _x,int _y,int _pred_last[3]);
-
-int oc_state_init(oc_theora_state *_state,const th_info *_info);
-void oc_state_clear(oc_theora_state *_state);
-void oc_state_vtable_init_c(oc_theora_state *_state);
-void oc_state_borders_fill_rows(oc_theora_state *_state,int _refi,int _pli,
- int _y0,int _yend);
-void oc_state_borders_fill_caps(oc_theora_state *_state,int _refi,int _pli);
-void oc_state_borders_fill(oc_theora_state *_state,int _refi);
-void oc_state_fill_buffer_ptrs(oc_theora_state *_state,int _buf_idx,
- th_ycbcr_buffer _img);
-int oc_state_mbi_for_pos(oc_theora_state *_state,int _mbx,int _mby);
-int oc_state_get_mv_offsets(oc_theora_state *_state,int *_offset0,
- int *_offset1,int _dx,int _dy,int _ystride,int _pli);
-
-int oc_state_loop_filter_init(oc_theora_state *_state,int *_bv);
-void oc_state_loop_filter(oc_theora_state *_state,int _frame);
-void oc_state_loop_filter_frag_rows(oc_theora_state *_state,int *_bv,
- int _refi,int _pli,int _fragy0,int _fragy_end);
-#if defined(OC_DUMP_IMAGES)
-int oc_state_dump_frame(const oc_theora_state *_state,int _frame,
- const char *_suf);
-#endif
-
-/*Shared accelerated functions.*/
-void oc_frag_recon_intra(const oc_theora_state *_state,unsigned char *_dst,int _dst_ystride,
- const ogg_int16_t *_residue);
-void oc_frag_recon_inter(const oc_theora_state *_state,unsigned char *_dst,int _dst_ystride,
- const unsigned char *_src,int _src_ystride,const ogg_int16_t *_residue);
-void oc_frag_recon_inter2(const oc_theora_state *_state,unsigned char *_dst,int _dst_ystride,
- const unsigned char *_src1,int _src1_ystride,const unsigned char *_src2,
- int _src2_ystride,const ogg_int16_t *_residue);
-void oc_state_frag_copy(const oc_theora_state *_state,const int *_fragis,
- int _nfragis,int _dst_frame,int _src_frame,int _pli);
-void oc_state_frag_recon(oc_theora_state *_state,const oc_fragment *_frag,
- int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,int _ncoefs,
- ogg_uint16_t _dc_iquant,const ogg_uint16_t _ac_iquant[64]);
-void oc_restore_fpu(const oc_theora_state *_state);
-
-/*Default pure-C implementations.*/
-void oc_frag_recon_intra_c(unsigned char *_dst,int _dst_ystride,
- const ogg_int16_t *_residue);
-void oc_frag_recon_inter_c(unsigned char *_dst,int _dst_ystride,
- const unsigned char *_src,int _src_ystride,const ogg_int16_t *_residue);
-void oc_frag_recon_inter2_c(unsigned char *_dst,int _dst_ystride,
- const unsigned char *_src1,int _src1_ystride,const unsigned char *_src2,
- int _src2_ystride,const ogg_int16_t *_residue);
-void oc_state_frag_copy_c(const oc_theora_state *_state,const int *_fragis,
- int _nfragis,int _dst_frame,int _src_frame,int _pli);
-void oc_state_frag_recon_c(oc_theora_state *_state,const oc_fragment *_frag,
- int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,int _ncoefs,
- ogg_uint16_t _dc_iquant,const ogg_uint16_t _ac_iquant[64]);
-void oc_restore_fpu_c(void);
-
-extern double theora_granule_time_enc(theora_state *th,ogg_int64_t granulepos);
-extern ogg_int64_t theora_granule_frame_enc(theora_state *th,ogg_int64_t granulepos);
-
-#endif
Deleted: experimental/j/theora-mashup/lib/dec/x86/cpu.c
===================================================================
--- experimental/j/theora-mashup/lib/dec/x86/cpu.c 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/dec/x86/cpu.c 2007-03-13 11:25:16 UTC (rev 12748)
@@ -1,100 +0,0 @@
-/********************************************************************
- * *
- * 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-2003 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************/
-/*CPU capability detection for x86 processors.
- Originally written by Rudolf Marek.*/
-
-#include "cpu.h"
-#include "x86int.h"
-
-#if defined(OC_X86ASM)
-
-ogg_uint32_t oc_cpu_flags_get(void){
- ogg_uint32_t eax;
- ogg_uint32_t ebx;
- ogg_uint32_t ecx;
- ogg_uint32_t edx;
- ogg_uint32_t flags;
-#if (defined(__amd64__) || defined(__x86_64__))
-# define cpuid(_op,_eax,_ebx,_ecx,_edx) \
- __asm__ __volatile__( \
- "push %%rbx\n\t" \
- "cpuid\n\t" \
- "movl %%ebx,%1\n\t" \
- "pop %%rbx\n\t" \
- :"=a" (_eax), \
- "=r" (_ebx), \
- "=c" (_ecx), \
- "=d" (_edx) \
- :"a" (_op) \
- :"cc" \
- )
-#else
-# define cpuid(_op,_eax,_ebx,_ecx,_edx) \
- __asm__ __volatile__( \
- "pushl %%ebx\n\t" \
- "cpuid\n\t" \
- "movl %%ebx,%1\n\t" \
- "popl %%ebx\n\t" \
- :"=a" (_eax), \
- "=r" (_ebx), \
- "=c" (_ecx), \
- "=d" (_edx) \
- :"a" (_op) \
- :"cc" \
- )
- __asm__ __volatile__(
- "pushfl\n\t"
- "pushfl\n\t"
- "popl %0\n\t"
- "movl %0,%1\n\t"
- "xorl $0x200000,%0\n\t"
- "pushl %0\n\t"
- "popfl\n\t"
- "pushfl\n\t"
- "popl %0\n\t"
- "popfl\n\t"
- :"=r" (eax),
- "=r" (ebx)
- :
- :"cc"
- );
- /*No cpuid.*/
- if(eax==ebx)return 0;
-#endif
- cpuid(0,eax,ebx,ecx,edx);
- if(ebx==0x756e6547&&edx==0x49656e69&&ecx==0x6c65746e){
- /*Intel:*/
-inteltest:
- cpuid(1,eax,ebx,ecx,edx);
- if((edx&0x00800000)==0)return 0;
- flags=OC_CPU_X86_MMX;
- if(edx&0x02000000)flags|=OC_CPU_X86_MMXEXT|OC_CPU_X86_SSE;
- if(edx&0x04000000)flags|=OC_CPU_X86_SSE2;
- }
- else if(ebx==0x68747541&&edx==0x69746e65&&ecx==0x444d4163){
- /*AMD:*/
- cpuid(0x80000000,eax,ebx,ecx,edx);
- if(eax<0x80000001)goto inteltest;
- cpuid(0x80000001,eax,ebx,ecx,edx);
- if((edx&0x00800000)==0)return 0;
- flags=OC_CPU_X86_MMX;
- if(edx&0x80000000)flags|=OC_CPU_X86_3DNOW;
- if(edx&0x00400000)flags|=OC_CPU_X86_MMXEXT;
- }
- else{
- /*Implement me.*/
- flags=0;
- }
- return flags;
-}
-
-#endif
Deleted: experimental/j/theora-mashup/lib/dec/x86/cpu.h
===================================================================
--- experimental/j/theora-mashup/lib/dec/x86/cpu.h 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/dec/x86/cpu.h 2007-03-13 11:25:16 UTC (rev 12748)
@@ -1,25 +0,0 @@
-/********************************************************************
- * *
- * 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-2003 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-*/
-#if !defined(_x86_cpu_H)
-# define _x86_cpu_H (1)
-#include "../internal.h"
-
-#define OC_CPU_X86_MMX (1<<0)
-#define OC_CPU_X86_3DNOW (1<<1)
-#define OC_CPU_X86_MMXEXT (1<<2)
-#define OC_CPU_X86_SSE (1<<3)
-#define OC_CPU_X86_SSE2 (1<<4)
-
-ogg_uint32_t oc_cpu_flags_get(void);
-
-#endif
Modified: experimental/j/theora-mashup/lib/dec/x86/mmxfrag.c
===================================================================
--- experimental/j/theora-mashup/lib/dec/x86/mmxfrag.c 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/dec/x86/mmxfrag.c 2007-03-13 11:25:16 UTC (rev 12748)
@@ -14,7 +14,7 @@
Originally written by Rudolf Marek.*/
#include "x86int.h"
-#if defined(OC_X86ASM)
+#if defined(USE_ASM)
static const __attribute__((aligned(8),used)) ogg_int64_t V128=
0x0080008000800080LL;
Modified: experimental/j/theora-mashup/lib/dec/x86/mmxidct.c
===================================================================
--- experimental/j/theora-mashup/lib/dec/x86/mmxidct.c 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/dec/x86/mmxidct.c 2007-03-13 11:25:16 UTC (rev 12748)
@@ -6,7 +6,7 @@
#include "x86int.h"
-#if defined(OC_X86ASM)
+#if defined(USE_ASM)
/*These are offsets into the table of constants below.*/
/*4 masks, in order: low word to high.*/
Modified: experimental/j/theora-mashup/lib/dec/x86/mmxstate.c
===================================================================
--- experimental/j/theora-mashup/lib/dec/x86/mmxstate.c 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/dec/x86/mmxstate.c 2007-03-13 11:25:16 UTC (rev 12748)
@@ -15,7 +15,7 @@
#include "x86int.h"
#include "../internal.h"
-#if defined(OC_X86ASM)
+#if defined(USE_ASM)
static const __attribute__((aligned(8),used)) int OC_FZIG_ZAGMMX[64]={
Modified: experimental/j/theora-mashup/lib/dec/x86/x86int.h
===================================================================
--- experimental/j/theora-mashup/lib/dec/x86/x86int.h 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/dec/x86/x86int.h 2007-03-13 11:25:16 UTC (rev 12748)
@@ -1,6 +1,6 @@
#if !defined(_x86_x86int_H)
# define _x86_x86int_H (1)
-# include "../internal.h"
+# include "internal.h"
void oc_state_vtable_init_x86(oc_theora_state *_state);
Modified: experimental/j/theora-mashup/lib/dec/x86/x86state.c
===================================================================
--- experimental/j/theora-mashup/lib/dec/x86/x86state.c 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/dec/x86/x86state.c 2007-03-13 11:25:16 UTC (rev 12748)
@@ -1,11 +1,11 @@
#include "x86int.h"
-#if defined(OC_X86ASM)
+#if defined(USE_ASM)
#include "cpu.h"
void oc_state_vtable_init_x86(oc_theora_state *_state){
- _state->cpu_flags=oc_cpu_flags_get();
+ _state->cpu_flags=oc_cpu_flags_get();
if(_state->cpu_flags&OC_CPU_X86_MMX){
_state->opt_vtable.frag_recon_intra=oc_frag_recon_intra_mmx;
_state->opt_vtable.frag_recon_inter=oc_frag_recon_inter_mmx;
Modified: experimental/j/theora-mashup/lib/enc/dct.c
===================================================================
--- experimental/j/theora-mashup/lib/enc/dct.c 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/enc/dct.c 2007-03-13 11:25:16 UTC (rev 12748)
@@ -17,7 +17,7 @@
#include "codec_internal.h"
#include "dsp.h"
-#include "enccpu.h"
+#include "cpu.h"
static ogg_int32_t xC1S7 = 64277;
static ogg_int32_t xC2S6 = 60547;
@@ -258,7 +258,7 @@
{
funcs->fdct_short = fdct_short__c;
#if defined(USE_ASM)
- if (cpu_flags & CPU_X86_MMX) {
+ if (cpu_flags & OC_CPU_X86_MMX) {
dsp_mmx_fdct_init(funcs);
}
#endif
Modified: experimental/j/theora-mashup/lib/enc/dsp.c
===================================================================
--- experimental/j/theora-mashup/lib/enc/dsp.c 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/enc/dsp.c 2007-03-13 11:25:16 UTC (rev 12748)
@@ -16,7 +16,7 @@
********************************************************************/
#include <stdlib.h>
-#include "enccpu.h"
+#include "cpu.h"
#include "dsp.h"
#include "codec_internal.h"
@@ -404,18 +404,18 @@
{
ogg_uint32_t cpuflags;
- cpuflags = cpu_init ();
+ cpuflags = oc_cpu_flags_get();
dsp_init (funcs);
dsp_recon_init (funcs, cpuflags);
dsp_dct_init (funcs, cpuflags);
#if defined(USE_ASM)
- if (cpuflags & CPU_X86_MMX) {
+ if (cpuflags & OC_CPU_X86_MMX) {
dsp_mmx_init(funcs);
}
# ifndef WIN32
/* This is implemented for win32 yet */
- if (cpuflags & CPU_X86_MMXEXT) {
+ if (cpuflags & OC_CPU_X86_MMXEXT) {
dsp_mmxext_init(funcs);
}
# endif
Deleted: experimental/j/theora-mashup/lib/enc/enccpu.c
===================================================================
--- experimental/j/theora-mashup/lib/enc/enccpu.c 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/enc/enccpu.c 2007-03-13 11:25:16 UTC (rev 12748)
@@ -1,153 +0,0 @@
-/********************************************************************
- * *
- * 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-2003 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function:
- last mod: $Id$
-
- ********************************************************************/
-
-#include "enccpu.h"
-
-void
-cpuid(ogg_int32_t op, ogg_uint32_t *out_eax, ogg_uint32_t *out_ebx, ogg_uint32_t *out_ecx, ogg_uint32_t *out_edx)
-{
-#ifdef USE_ASM
-# if defined(__x86_64__)
- asm volatile ("pushq %%rbx \n\t"
- "cpuid \n\t"
- "movl %%ebx,%1 \n\t"
- "popq %%rbx"
- : "=a" (*out_eax),
- "=r" (*out_ebx),
- "=c" (*out_ecx),
- "=d" (*out_edx)
- : "a" (op)
- : "cc");
-# elif defined(__i386__)
- asm volatile ("pushl %%ebx \n\t"
- "cpuid \n\t"
- "movl %%ebx,%1 \n\t"
- "popl %%ebx"
- : "=a" (*out_eax),
- "=r" (*out_ebx),
- "=c" (*out_ecx),
- "=d" (*out_edx)
- : "a" (op)
- : "cc");
-# elif defined(WIN32)
- ogg_uint32_t my_eax, my_ebx, my_ecx, my_edx;
- __asm {
- //push ebx
- mov eax, op
- cpuid
- mov my_eax, eax
- mov my_ebx, ebx
- mov my_ecx, ecx
- mov my_edx, edx
-
-
-
- };
-
- *out_eax = my_eax;
- *out_ebx = my_ebx;
- *out_ecx = my_ecx;
- *out_edx = my_edx;
-# endif
-
-#endif
-}
-
-#if defined(USE_ASM)
-
-static ogg_uint32_t cpu_get_flags (void)
-{
- ogg_uint32_t eax, ebx, ecx, edx;
- ogg_uint32_t flags = 0;
-
- /* check for cpuid support on i386 */
-#if defined(__i386__)
- asm volatile ("pushfl \n\t"
- "pushfl \n\t"
- "popl %0 \n\t"
- "movl %0,%1 \n\t"
- "xorl $0x200000,%0 \n\t"
- "pushl %0 \n\t"
- "popfl \n\t"
- "pushfl \n\t"
- "popl %0 \n\t"
- "popfl"
- : "=r" (eax),
- "=r" (ebx)
- :
- : "cc");
-
- if (eax == ebx) /* no cpuid */
- return 0;
-#endif
-
- /*cpuid(0, &eax, &ebx, &ecx, &edx); */
- /* Intel */
- cpuid(1, &eax, &ebx, &ecx, &edx);
- if ((edx & 0x00800000) == 0)
- return 0;
- flags |= CPU_X86_MMX;
- if (edx & 0x02000000)
- flags |= CPU_X86_MMXEXT | CPU_X86_SSE;
- if (edx & 0x04000000)
- flags |= CPU_X86_SSE2;
-
- /* AMD */
- cpuid(0x80000000, &eax, &ebx, &ecx, &edx);
- if(eax >= 0x80000001) {
- cpuid(0x80000001, &eax, &ebx, &ecx, &edx);
- if ((edx & 0x00800000) != 0) {
- flags |= CPU_X86_MMX;
- if (edx & 0x80000000)
- flags |= CPU_X86_3DNOW;
- if (edx & 0x40000000)
- flags |= CPU_X86_3DNOWEXT;
- if (edx & 0x00400000)
- flags |= CPU_X86_MMXEXT;
- }
- }
-
- return flags;
-}
-
-#else /* no supported cpu architecture */
-
-static ogg_uint32_t cpu_get_flags (void) {
- return 0;
-}
-
-#endif /* USE_ASM */
-
-ogg_uint32_t cpu_init (void)
-{
- ogg_uint32_t cpu_flags = cpu_get_flags();
-
-#ifdef DEBUG
- if (cpu_flags) {
- TH_DEBUG("vectorized instruction sets supported:");
- if (cpu_flags & CPU_X86_MMX) TH_DEBUG(" mmx");
- if (cpu_flags & CPU_X86_MMXEXT) TH_DEBUG(" mmxext");
- if (cpu_flags & CPU_X86_SSE) TH_DEBUG(" sse");
- if (cpu_flags & CPU_X86_SSE2) TH_DEBUG(" sse2");
- if (cpu_flags & CPU_X86_3DNOW) TH_DEBUG(" 3dnow");
- if (cpu_flags & CPU_X86_3DNOWEXT) TH_DEBUG(" 3dnowext");
- TH_DEBUG("\n");
- }
-#endif
-
- return cpu_flags;
-}
Deleted: experimental/j/theora-mashup/lib/enc/enccpu.h
===================================================================
--- experimental/j/theora-mashup/lib/enc/enccpu.h 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/enc/enccpu.h 2007-03-13 11:25:16 UTC (rev 12748)
@@ -1,30 +0,0 @@
-/********************************************************************
- * *
- * 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-2003 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function:
- last mod: $Id$
-
- ********************************************************************/
-
-#include "codec_internal.h"
-
-//extern ogg_uint32_t cpu_flags;
-
-#define CPU_X86_MMX (1<<0)
-#define CPU_X86_3DNOW (1<<1)
-#define CPU_X86_MMXEXT (1<<2)
-#define CPU_X86_SSE (1<<3)
-#define CPU_X86_SSE2 (1<<4)
-#define CPU_X86_3DNOWEXT (1<<5)
-
-ogg_uint32_t cpu_init (void);
-
Deleted: experimental/j/theora-mashup/lib/enc/encidct.c
===================================================================
--- experimental/j/theora-mashup/lib/enc/encidct.c 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/enc/encidct.c 2007-03-13 11:25:16 UTC (rev 12748)
@@ -1,555 +0,0 @@
-/********************************************************************
- * *
- * 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-2003 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: C implementation of the Theora iDCT
- last mod: $Id$
-
- ********************************************************************/
-
-#include <string.h>
-#include "codec_internal.h"
-#include "quant_lookup.h"
-
-#define IdctAdjustBeforeShift 8
-
-/* cos(n*pi/16) or sin(8-n)*pi/16) */
-#define xC1S7 64277
-#define xC2S6 60547
-#define xC3S5 54491
-#define xC4S4 46341
-#define xC5S3 36410
-#define xC6S2 25080
-#define xC7S1 12785
-
-/* compute the 16 bit signed 1D inverse DCT - spec version */
-static void idct_short__c ( ogg_int16_t * InputData, ogg_int16_t * OutputData ) {
- ogg_int32_t t[8], r;
- ogg_int16_t *y = InputData;
- ogg_int16_t *x = OutputData;
-
- t[0] = y[0] + y[4];
- t[0] &= 0xffff;
- t[0] = (xC4S4 * t[0]) >> 16;
-
- t[1] = y[0] - y[4];
- t[1] &= 0xffff;
- t[1] = (xC4S4 * t[1]) >> 16;
-
- t[2] = ((xC6S2 * t[2]) >> 16) - ((xC2S6 * y[6]) >> 16);
- t[3] = ((xC2S6 * t[2]) >> 16) + ((xC6S2 * y[6]) >> 16);
- t[4] = ((xC7S1 * t[1]) >> 16) - ((xC1S7 * y[7]) >> 16);
- t[5] = ((xC3S5 * t[5]) >> 16) - ((xC5S3 * y[3]) >> 16);
- t[6] = ((xC5S3 * t[5]) >> 16) + ((xC3S5 * y[3]) >> 16);
- t[7] = ((xC1S7 * t[1]) >> 16) + ((xC7S1 * y[7]) >> 16);
-
- r = t[4] + t[5];
- t[5] = t[4] - t[5];
- t[5] &= 0xffff;
- t[5] = (xC4S4 * (-t[5])) >> 16;
- t[4] = r;
-
- r = t[7] + t[6];
- t[6] = t[7] - t[6];
- t[6] &= 0xffff;
- t[6] = (xC4S4 * t[6]) >> 16;
- t[7] = r;
-
- r = t[0] + t[3];
- t[3] = t[0] - t[3];
- t[0] = r;
-
- r = t[1] + t[2];
- t[2] = t[1] - t[2];
- t[1] = r;
-
- r = t[6] + t[5];
- t[5] = t[6] - t[5];
- t[6] = r;
-
- r = t[0] + t[7];
- r &= 0xffff;
- x[0] = r;
-
- r = t[1] + t[6];
- r &= 0xffff;
- x[1] = r;
-
- r = t[2] + t[5];
- r &= 0xffff;
- x[2] = r;
-
- r = t[3] + t[4];
- r &= 0xffff;
- x[3] = r;
-
- r = t[3] - t[4];
- r &= 0xffff;
- x[4] = r;
-
- r = t[2] - t[5];
- r &= 0xffff;
- x[5] = r;
-
- r = t[1] - t[6];
- r &= 0xffff;
- x[6] = r;
-
- r = t[0] - t[7];
- r &= 0xffff;
- x[7] = r;
-
-}
-
-static void dequant_slow( ogg_int16_t * dequant_coeffs,
- ogg_int16_t * quantized_list,
- ogg_int32_t * DCT_block) {
- int i;
- for(i=0;i<64;i++)
- DCT_block[dezigzag_index[i]] = quantized_list[i] * dequant_coeffs[i];
-}
-
-
-
-void IDctSlow( Q_LIST_ENTRY * InputData,
- ogg_int16_t *QuantMatrix,
- ogg_int16_t * OutputData ) {
- ogg_int32_t IntermediateData[64];
- ogg_int32_t * ip = IntermediateData;
- ogg_int16_t * op = OutputData;
-
- ogg_int32_t _A, _B, _C, _D, _Ad, _Bd, _Cd, _Dd, _E, _F, _G, _H;
- ogg_int32_t _Ed, _Gd, _Add, _Bdd, _Fd, _Hd;
- ogg_int32_t t1, t2;
-
- int loop;
-
- dequant_slow( QuantMatrix, InputData, IntermediateData);
-
- /* Inverse DCT on the rows now */
- for ( loop = 0; loop < 8; loop++){
- /* Check for non-zero values */
- if ( ip[0] | ip[1] | ip[2] | ip[3] | ip[4] | ip[5] | ip[6] | ip[7] ) {
- t1 = (xC1S7 * ip[1]);
- t2 = (xC7S1 * ip[7]);
- t1 >>= 16;
- t2 >>= 16;
- _A = t1 + t2;
-
- t1 = (xC7S1 * ip[1]);
- t2 = (xC1S7 * ip[7]);
- t1 >>= 16;
- t2 >>= 16;
- _B = t1 - t2;
-
- t1 = (xC3S5 * ip[3]);
- t2 = (xC5S3 * ip[5]);
- t1 >>= 16;
- t2 >>= 16;
- _C = t1 + t2;
-
- t1 = (xC3S5 * ip[5]);
- t2 = (xC5S3 * ip[3]);
- t1 >>= 16;
- t2 >>= 16;
- _D = t1 - t2;
-
- t1 = (xC4S4 * (ogg_int16_t)(_A - _C));
- t1 >>= 16;
- _Ad = t1;
-
- t1 = (xC4S4 * (ogg_int16_t)(_B - _D));
- t1 >>= 16;
- _Bd = t1;
-
-
- _Cd = _A + _C;
- _Dd = _B + _D;
-
- t1 = (xC4S4 * (ogg_int16_t)(ip[0] + ip[4]));
- t1 >>= 16;
- _E = t1;
-
- t1 = (xC4S4 * (ogg_int16_t)(ip[0] - ip[4]));
- t1 >>= 16;
- _F = t1;
-
- t1 = (xC2S6 * ip[2]);
- t2 = (xC6S2 * ip[6]);
- t1 >>= 16;
- t2 >>= 16;
- _G = t1 + t2;
-
- t1 = (xC6S2 * ip[2]);
- t2 = (xC2S6 * ip[6]);
- t1 >>= 16;
- t2 >>= 16;
- _H = t1 - t2;
-
-
- _Ed = _E - _G;
- _Gd = _E + _G;
-
- _Add = _F + _Ad;
- _Bdd = _Bd - _H;
-
- _Fd = _F - _Ad;
- _Hd = _Bd + _H;
-
- /* Final sequence of operations over-write original inputs. */
- ip[0] = (ogg_int16_t)((_Gd + _Cd ) >> 0);
- ip[7] = (ogg_int16_t)((_Gd - _Cd ) >> 0);
-
- ip[1] = (ogg_int16_t)((_Add + _Hd ) >> 0);
- ip[2] = (ogg_int16_t)((_Add - _Hd ) >> 0);
-
- ip[3] = (ogg_int16_t)((_Ed + _Dd ) >> 0);
- ip[4] = (ogg_int16_t)((_Ed - _Dd ) >> 0);
-
- ip[5] = (ogg_int16_t)((_Fd + _Bdd ) >> 0);
- ip[6] = (ogg_int16_t)((_Fd - _Bdd ) >> 0);
-
- }
-
- ip += 8; /* next row */
- }
-
- ip = IntermediateData;
-
- for ( loop = 0; loop < 8; loop++){
- /* Check for non-zero values (bitwise or faster than ||) */
- if ( ip[0 * 8] | ip[1 * 8] | ip[2 * 8] | ip[3 * 8] |
- ip[4 * 8] | ip[5 * 8] | ip[6 * 8] | ip[7 * 8] ) {
-
- t1 = (xC1S7 * ip[1*8]);
- t2 = (xC7S1 * ip[7*8]);
- t1 >>= 16;
- t2 >>= 16;
- _A = t1 + t2;
-
- t1 = (xC7S1 * ip[1*8]);
- t2 = (xC1S7 * ip[7*8]);
- t1 >>= 16;
- t2 >>= 16;
- _B = t1 - t2;
-
- t1 = (xC3S5 * ip[3*8]);
- t2 = (xC5S3 * ip[5*8]);
- t1 >>= 16;
- t2 >>= 16;
- _C = t1 + t2;
-
- t1 = (xC3S5 * ip[5*8]);
- t2 = (xC5S3 * ip[3*8]);
- t1 >>= 16;
- t2 >>= 16;
- _D = t1 - t2;
-
- t1 = (xC4S4 * (ogg_int16_t)(_A - _C));
- t1 >>= 16;
- _Ad = t1;
-
- t1 = (xC4S4 * (ogg_int16_t)(_B - _D));
- t1 >>= 16;
- _Bd = t1;
-
-
- _Cd = _A + _C;
- _Dd = _B + _D;
-
- t1 = (xC4S4 * (ogg_int16_t)(ip[0*8] + ip[4*8]));
- t1 >>= 16;
- _E = t1;
-
- t1 = (xC4S4 * (ogg_int16_t)(ip[0*8] - ip[4*8]));
- t1 >>= 16;
- _F = t1;
-
- t1 = (xC2S6 * ip[2*8]);
- t2 = (xC6S2 * ip[6*8]);
- t1 >>= 16;
- t2 >>= 16;
- _G = t1 + t2;
-
- t1 = (xC6S2 * ip[2*8]);
- t2 = (xC2S6 * ip[6*8]);
- t1 >>= 16;
- t2 >>= 16;
- _H = t1 - t2;
-
- _Ed = _E - _G;
- _Gd = _E + _G;
-
- _Add = _F + _Ad;
- _Bdd = _Bd - _H;
-
- _Fd = _F - _Ad;
- _Hd = _Bd + _H;
-
- _Gd += IdctAdjustBeforeShift;
- _Add += IdctAdjustBeforeShift;
- _Ed += IdctAdjustBeforeShift;
- _Fd += IdctAdjustBeforeShift;
-
- /* Final sequence of operations over-write original inputs. */
- op[0*8] = (ogg_int16_t)((_Gd + _Cd ) >> 4);
- op[7*8] = (ogg_int16_t)((_Gd - _Cd ) >> 4);
-
- op[1*8] = (ogg_int16_t)((_Add + _Hd ) >> 4);
- op[2*8] = (ogg_int16_t)((_Add - _Hd ) >> 4);
-
- op[3*8] = (ogg_int16_t)((_Ed + _Dd ) >> 4);
- op[4*8] = (ogg_int16_t)((_Ed - _Dd ) >> 4);
-
- op[5*8] = (ogg_int16_t)((_Fd + _Bdd ) >> 4);
- op[6*8] = (ogg_int16_t)((_Fd - _Bdd ) >> 4);
- }else{
- op[0*8] = 0;
- op[7*8] = 0;
- op[1*8] = 0;
- op[2*8] = 0;
- op[3*8] = 0;
- op[4*8] = 0;
- op[5*8] = 0;
- op[6*8] = 0;
- }
-
- ip++; /* next column */
- op++;
- }
-}
-
-/************************
- x x x x 0 0 0 0
- x x x 0 0 0 0 0
- x x 0 0 0 0 0 0
- x 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
-*************************/
-
-static void dequant_slow10( ogg_int16_t * dequant_coeffs,
- ogg_int16_t * quantized_list,
- ogg_int32_t * DCT_block){
- int i;
- memset(DCT_block,0, 128);
- for(i=0;i<10;i++)
- DCT_block[dezigzag_index[i]] = quantized_list[i] * dequant_coeffs[i];
-
-}
-
-void IDct10( Q_LIST_ENTRY * InputData,
- ogg_int16_t *QuantMatrix,
- ogg_int16_t * OutputData ){
- ogg_int32_t IntermediateData[64];
- ogg_int32_t * ip = IntermediateData;
- ogg_int16_t * op = OutputData;
-
- ogg_int32_t _A, _B, _C, _D, _Ad, _Bd, _Cd, _Dd, _E, _F, _G, _H;
- ogg_int32_t _Ed, _Gd, _Add, _Bdd, _Fd, _Hd;
- ogg_int32_t t1, t2;
-
- int loop;
-
- dequant_slow10( QuantMatrix, InputData, IntermediateData);
-
- /* Inverse DCT on the rows now */
- for ( loop = 0; loop < 4; loop++){
- /* Check for non-zero values */
- if ( ip[0] | ip[1] | ip[2] | ip[3] ){
- t1 = (xC1S7 * ip[1]);
- t1 >>= 16;
- _A = t1;
-
- t1 = (xC7S1 * ip[1]);
- t1 >>= 16;
- _B = t1 ;
-
- t1 = (xC3S5 * ip[3]);
- t1 >>= 16;
- _C = t1;
-
- t2 = (xC5S3 * ip[3]);
- t2 >>= 16;
- _D = -t2;
-
-
- t1 = (xC4S4 * (ogg_int16_t)(_A - _C));
- t1 >>= 16;
- _Ad = t1;
-
- t1 = (xC4S4 * (ogg_int16_t)(_B - _D));
- t1 >>= 16;
- _Bd = t1;
-
-
- _Cd = _A + _C;
- _Dd = _B + _D;
-
- t1 = (xC4S4 * ip[0] );
- t1 >>= 16;
- _E = t1;
-
- _F = t1;
-
- t1 = (xC2S6 * ip[2]);
- t1 >>= 16;
- _G = t1;
-
- t1 = (xC6S2 * ip[2]);
- t1 >>= 16;
- _H = t1 ;
-
-
- _Ed = _E - _G;
- _Gd = _E + _G;
-
- _Add = _F + _Ad;
- _Bdd = _Bd - _H;
-
- _Fd = _F - _Ad;
- _Hd = _Bd + _H;
-
- /* Final sequence of operations over-write original inputs. */
- ip[0] = (ogg_int16_t)((_Gd + _Cd ) >> 0);
- ip[7] = (ogg_int16_t)((_Gd - _Cd ) >> 0);
-
- ip[1] = (ogg_int16_t)((_Add + _Hd ) >> 0);
- ip[2] = (ogg_int16_t)((_Add - _Hd ) >> 0);
-
- ip[3] = (ogg_int16_t)((_Ed + _Dd ) >> 0);
- ip[4] = (ogg_int16_t)((_Ed - _Dd ) >> 0);
-
- ip[5] = (ogg_int16_t)((_Fd + _Bdd ) >> 0);
- ip[6] = (ogg_int16_t)((_Fd - _Bdd ) >> 0);
-
- }
-
- ip += 8; /* next row */
- }
-
- ip = IntermediateData;
-
- for ( loop = 0; loop < 8; loop++) {
- /* Check for non-zero values (bitwise or faster than ||) */
- if ( ip[0 * 8] | ip[1 * 8] | ip[2 * 8] | ip[3 * 8] ) {
-
- t1 = (xC1S7 * ip[1*8]);
- t1 >>= 16;
- _A = t1 ;
-
- t1 = (xC7S1 * ip[1*8]);
- t1 >>= 16;
- _B = t1 ;
-
- t1 = (xC3S5 * ip[3*8]);
- t1 >>= 16;
- _C = t1 ;
-
- t2 = (xC5S3 * ip[3*8]);
- t2 >>= 16;
- _D = - t2;
-
-
- t1 = (xC4S4 * (ogg_int16_t)(_A - _C));
- t1 >>= 16;
- _Ad = t1;
-
- t1 = (xC4S4 * (ogg_int16_t)(_B - _D));
- t1 >>= 16;
- _Bd = t1;
-
-
- _Cd = _A + _C;
- _Dd = _B + _D;
-
- t1 = (xC4S4 * ip[0*8]);
- t1 >>= 16;
- _E = t1;
- _F = t1;
-
- t1 = (xC2S6 * ip[2*8]);
- t1 >>= 16;
- _G = t1;
-
- t1 = (xC6S2 * ip[2*8]);
- t1 >>= 16;
- _H = t1;
-
-
- _Ed = _E - _G;
- _Gd = _E + _G;
-
- _Add = _F + _Ad;
- _Bdd = _Bd - _H;
-
- _Fd = _F - _Ad;
- _Hd = _Bd + _H;
-
- _Gd += IdctAdjustBeforeShift;
- _Add += IdctAdjustBeforeShift;
- _Ed += IdctAdjustBeforeShift;
- _Fd += IdctAdjustBeforeShift;
-
- /* Final sequence of operations over-write original inputs. */
- op[0*8] = (ogg_int16_t)((_Gd + _Cd ) >> 4);
- op[7*8] = (ogg_int16_t)((_Gd - _Cd ) >> 4);
-
- op[1*8] = (ogg_int16_t)((_Add + _Hd ) >> 4);
- op[2*8] = (ogg_int16_t)((_Add - _Hd ) >> 4);
-
- op[3*8] = (ogg_int16_t)((_Ed + _Dd ) >> 4);
- op[4*8] = (ogg_int16_t)((_Ed - _Dd ) >> 4);
-
- op[5*8] = (ogg_int16_t)((_Fd + _Bdd ) >> 4);
- op[6*8] = (ogg_int16_t)((_Fd - _Bdd ) >> 4);
- }else{
- op[0*8] = 0;
- op[7*8] = 0;
- op[1*8] = 0;
- op[2*8] = 0;
- op[3*8] = 0;
- op[4*8] = 0;
- op[5*8] = 0;
- op[6*8] = 0;
- }
-
- ip++; /* next column */
- op++;
- }
-}
-
-/***************************
- x 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
-**************************/
-
-void IDct1( Q_LIST_ENTRY * InputData,
- ogg_int16_t *QuantMatrix,
- ogg_int16_t * OutputData ){
- int loop;
-
- ogg_int16_t OutD;
-
- OutD=(ogg_int16_t) ((ogg_int32_t)(InputData[0]*QuantMatrix[0]+15)>>5);
-
- for(loop=0;loop<64;loop++)
- OutputData[loop]=OutD;
-
-}
Copied: experimental/j/theora-mashup/lib/enc/encoder_idct.c (from rev 12737, experimental/j/theora-mashup/lib/enc/encidct.c)
Modified: experimental/j/theora-mashup/lib/enc/reconstruct.c
===================================================================
--- experimental/j/theora-mashup/lib/enc/reconstruct.c 2007-03-13 09:02:01 UTC (rev 12747)
+++ experimental/j/theora-mashup/lib/enc/reconstruct.c 2007-03-13 11:25:16 UTC (rev 12748)
@@ -17,7 +17,7 @@
#include "codec_internal.h"
#include "dsp.h"
-#include "enccpu.h"
+#include "cpu.h"
static void copy8x8__c (unsigned char *src,
unsigned char *dest,
@@ -105,7 +105,7 @@
funcs->recon_inter8x8 = recon_inter8x8__c;
funcs->recon_inter8x8_half = recon_inter8x8_half__c;
#if defined(USE_ASM)
- if (cpu_flags & CPU_X86_MMX) {
+ if (cpu_flags & OC_CPU_X86_MMX) {
dsp_mmx_recon_init(funcs);
}
#endif
Copied: experimental/j/theora-mashup/lib/internal.h (from rev 12742, experimental/j/theora-mashup/lib/dec/internal.h)
More information about the commits
mailing list