Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
56f8952b
Commit
56f8952b
authored
Jan 21, 2011
by
Justin Ruggles
Committed by
Mans Rullgard
Jan 21, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move lpc_compute_autocorr() from DSPContext to a new struct LPCContext.
Signed-off-by:
Mans Rullgard
<
mans@mansr.com
>
parent
50196a98
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
63 additions
and
43 deletions
+63
-43
alacenc.c
libavcodec/alacenc.c
+7
-7
asm-offsets.h
libavcodec/arm/asm-offsets.h
+6
-6
dsputil.c
libavcodec/dsputil.c
+0
-4
dsputil.h
libavcodec/dsputil.h
+0
-2
flacenc.c
libavcodec/flacenc.c
+3
-4
lpc.c
libavcodec/lpc.c
+10
-3
lpc.h
libavcodec/lpc.h
+21
-3
ra144.h
libavcodec/ra144.h
+2
-2
ra144enc.c
libavcodec/ra144enc.c
+2
-3
dsputil_mmx.h
libavcodec/x86/dsputil_mmx.h
+0
-3
dsputilenc_mmx.c
libavcodec/x86/dsputilenc_mmx.c
+0
-4
lpc_mmx.c
libavcodec/x86/lpc_mmx.c
+12
-2
No files found.
libavcodec/alacenc.c
View file @
56f8952b
...
...
@@ -51,11 +51,11 @@ typedef struct RiceContext {
int
rice_modifier
;
}
RiceContext
;
typedef
struct
LPCContext
{
typedef
struct
Alac
LPCContext
{
int
lpc_order
;
int
lpc_coeff
[
ALAC_MAX_LPC_ORDER
+
1
];
int
lpc_quant
;
}
LPCContext
;
}
Alac
LPCContext
;
typedef
struct
AlacEncodeContext
{
int
compression_level
;
...
...
@@ -69,8 +69,8 @@ typedef struct AlacEncodeContext {
int
interlacing_leftweight
;
PutBitContext
pbctx
;
RiceContext
rc
;
LPCContext
lpc
[
MAX_CHANNELS
];
DSPContext
dsp
ctx
;
Alac
LPCContext
lpc
[
MAX_CHANNELS
];
LPCContext
lpc_
ctx
;
AVCodecContext
*
avctx
;
}
AlacEncodeContext
;
...
...
@@ -141,7 +141,7 @@ static void calc_predictor_params(AlacEncodeContext *s, int ch)
s
->
lpc
[
ch
].
lpc_coeff
[
4
]
=
80
;
s
->
lpc
[
ch
].
lpc_coeff
[
5
]
=
-
25
;
}
else
{
opt_order
=
ff_lpc_calc_coefs
(
&
s
->
dsp
ctx
,
s
->
sample_buf
[
ch
],
opt_order
=
ff_lpc_calc_coefs
(
&
s
->
lpc_
ctx
,
s
->
sample_buf
[
ch
],
s
->
avctx
->
frame_size
,
s
->
min_prediction_order
,
s
->
max_prediction_order
,
...
...
@@ -237,7 +237,7 @@ static void alac_stereo_decorrelation(AlacEncodeContext *s)
static
void
alac_linear_predictor
(
AlacEncodeContext
*
s
,
int
ch
)
{
int
i
;
LPCContext
lpc
=
s
->
lpc
[
ch
];
Alac
LPCContext
lpc
=
s
->
lpc
[
ch
];
if
(
lpc
.
lpc_order
==
31
)
{
s
->
predictor_buf
[
0
]
=
s
->
sample_buf
[
ch
][
0
];
...
...
@@ -455,7 +455,7 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
avctx
->
coded_frame
->
key_frame
=
1
;
s
->
avctx
=
avctx
;
dsputil_init
(
&
s
->
dspctx
,
av
ctx
);
ff_lpc_init
(
&
s
->
lpc_
ctx
);
return
0
;
}
...
...
libavcodec/arm/asm-offsets.h
View file @
56f8952b
...
...
@@ -33,16 +33,16 @@
#define Y_DC_SCALE 0xab4
#define C_DC_SCALE 0xab8
#define AC_PRED 0xae0
#define BLOCK_LAST_INDEX 0x21
c0
#define INTER_SCANTAB_RASTER_END 0x23
c0
#define H263_AIC 0x26
70
#define BLOCK_LAST_INDEX 0x21
bc
#define INTER_SCANTAB_RASTER_END 0x23
bc
#define H263_AIC 0x26
68
#elif defined(__APPLE__)
#define Y_DC_SCALE 0xa70
#define C_DC_SCALE 0xa74
#define AC_PRED 0xa9c
#define BLOCK_LAST_INDEX 0x217
c
#define INTER_SCANTAB_RASTER_END 0x237
c
#define H263_AIC 0x26
20
#define BLOCK_LAST_INDEX 0x217
8
#define INTER_SCANTAB_RASTER_END 0x237
8
#define H263_AIC 0x26
1c
#endif
#endif
libavcodec/dsputil.c
View file @
56f8952b
...
...
@@ -36,7 +36,6 @@
#include "mathops.h"
#include "mpegvideo.h"
#include "config.h"
#include "lpc.h"
#include "ac3dec.h"
#include "vorbis.h"
#include "png.h"
...
...
@@ -4430,9 +4429,6 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
#endif
#if CONFIG_AC3_DECODER
c
->
ac3_downmix
=
ff_ac3_downmix_c
;
#endif
#if CONFIG_LPC
c
->
lpc_compute_autocorr
=
ff_lpc_compute_autocorr
;
#endif
c
->
vector_fmul
=
vector_fmul_c
;
c
->
vector_fmul_reverse
=
vector_fmul_reverse_c
;
...
...
libavcodec/dsputil.h
View file @
56f8952b
...
...
@@ -374,8 +374,6 @@ typedef struct DSPContext {
/* assume len is a multiple of 4, and arrays are 16-byte aligned */
void
(
*
vorbis_inverse_coupling
)(
float
*
mag
,
float
*
ang
,
int
blocksize
);
void
(
*
ac3_downmix
)(
float
(
*
samples
)[
256
],
float
(
*
matrix
)[
2
],
int
out_ch
,
int
in_ch
,
int
len
);
/* no alignment needed */
void
(
*
lpc_compute_autocorr
)(
const
int32_t
*
data
,
int
len
,
int
lag
,
double
*
autoc
);
/* assume len is a multiple of 8, and arrays are 16-byte aligned */
void
(
*
vector_fmul
)(
float
*
dst
,
const
float
*
src
,
int
len
);
void
(
*
vector_fmul_reverse
)(
float
*
dst
,
const
float
*
src0
,
const
float
*
src1
,
int
len
);
...
...
libavcodec/flacenc.c
View file @
56f8952b
...
...
@@ -23,7 +23,6 @@
#include "libavutil/md5.h"
#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"
#include "golomb.h"
#include "lpc.h"
#include "flac.h"
...
...
@@ -95,7 +94,7 @@ typedef struct FlacEncodeContext {
FlacFrame
frame
;
CompressionOptions
options
;
AVCodecContext
*
avctx
;
DSPContext
dsp
;
LPCContext
lpc_ctx
;
struct
AVMD5
*
md5ctx
;
}
FlacEncodeContext
;
...
...
@@ -217,7 +216,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
s
->
avctx
=
avctx
;
dsputil_init
(
&
s
->
dsp
,
av
ctx
);
ff_lpc_init
(
&
s
->
lpc_
ctx
);
if
(
avctx
->
sample_fmt
!=
AV_SAMPLE_FMT_S16
)
return
-
1
;
...
...
@@ -902,7 +901,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
/* LPC */
sub
->
type
=
FLAC_SUBFRAME_LPC
;
opt_order
=
ff_lpc_calc_coefs
(
&
s
->
dsp
,
smp
,
n
,
min_order
,
max_order
,
opt_order
=
ff_lpc_calc_coefs
(
&
s
->
lpc_ctx
,
smp
,
n
,
min_order
,
max_order
,
s
->
options
.
lpc_coeff_precision
,
coefs
,
shift
,
s
->
options
.
lpc_type
,
s
->
options
.
lpc_passes
,
omethod
,
MAX_LPC_SHIFT
,
0
);
...
...
libavcodec/lpc.c
View file @
56f8952b
...
...
@@ -20,7 +20,6 @@
*/
#include "libavutil/lls.h"
#include "dsputil.h"
#define LPC_USE_DOUBLE
#include "lpc.h"
...
...
@@ -55,7 +54,7 @@ static void apply_welch_window(const int32_t *data, int len, double *w_data)
* Calculate autocorrelation data from audio samples
* A Welch window function is applied before calculation.
*/
void
ff_lpc_compute_autocorr
(
const
int32_t
*
data
,
int
len
,
int
lag
,
static
void
lpc_compute_autocorr_c
(
const
int32_t
*
data
,
int
len
,
int
lag
,
double
*
autoc
)
{
int
i
,
j
;
...
...
@@ -162,7 +161,7 @@ static int estimate_best_order(double *ref, int min_order, int max_order)
* 1 = LPC with coeffs determined by Levinson-Durbin recursion
* 2+ = LPC with coeffs determined by Cholesky factorization using (use_lpc-1) passes.
*/
int
ff_lpc_calc_coefs
(
DSP
Context
*
s
,
int
ff_lpc_calc_coefs
(
LPC
Context
*
s
,
const
int32_t
*
samples
,
int
blocksize
,
int
min_order
,
int
max_order
,
int
precision
,
int32_t
coefs
[][
MAX_LPC_ORDER
],
int
*
shift
,
...
...
@@ -236,3 +235,11 @@ int ff_lpc_calc_coefs(DSPContext *s,
return
opt_order
;
}
av_cold
void
ff_lpc_init
(
LPCContext
*
s
)
{
s
->
lpc_compute_autocorr
=
lpc_compute_autocorr_c
;
if
(
HAVE_MMX
)
ff_lpc_init_x86
(
s
);
}
libavcodec/lpc.h
View file @
56f8952b
...
...
@@ -36,18 +36,36 @@
#define MAX_LPC_ORDER 32
typedef
struct
LPCContext
{
/**
* Perform autocorrelation on input samples with delay of 0 to lag.
* @param data input samples.
* no alignment needed.
* @param len number of input samples to process
* @param lag maximum delay to calculate
* @param autoc output autocorrelation coefficients.
* constraints: array size must be at least lag+1.
*/
void
(
*
lpc_compute_autocorr
)(
const
int32_t
*
data
,
int
len
,
int
lag
,
double
*
autoc
);
}
LPCContext
;
/**
* Calculate LPC coefficients for multiple orders
*/
int
ff_lpc_calc_coefs
(
DSP
Context
*
s
,
int
ff_lpc_calc_coefs
(
LPC
Context
*
s
,
const
int32_t
*
samples
,
int
blocksize
,
int
min_order
,
int
max_order
,
int
precision
,
int32_t
coefs
[][
MAX_LPC_ORDER
],
int
*
shift
,
enum
AVLPCType
lpc_type
,
int
lpc_passes
,
int
omethod
,
int
max_shift
,
int
zero_shift
);
void
ff_lpc_compute_autocorr
(
const
int32_t
*
data
,
int
len
,
int
lag
,
double
*
autoc
);
/**
* Initialize LPCContext.
*/
void
ff_lpc_init
(
LPCContext
*
s
);
void
ff_lpc_init_x86
(
LPCContext
*
s
);
#ifdef LPC_USE_DOUBLE
#define LPC_TYPE double
...
...
libavcodec/ra144.h
View file @
56f8952b
...
...
@@ -23,7 +23,7 @@
#define AVCODEC_RA144_H
#include <stdint.h>
#include "
dsputil
.h"
#include "
lpc
.h"
#define NBLOCKS 4 ///< number of subblocks within a block
#define BLOCKSIZE 40 ///< subblock size in 16-bit words
...
...
@@ -34,7 +34,7 @@
typedef
struct
{
AVCodecContext
*
avctx
;
DSPContext
dsp
;
LPCContext
lpc_ctx
;
unsigned
int
old_energy
;
///< previous frame energy
...
...
libavcodec/ra144enc.c
View file @
56f8952b
...
...
@@ -29,7 +29,6 @@
#include "avcodec.h"
#include "put_bits.h"
#include "lpc.h"
#include "celp_filters.h"
#include "ra144.h"
...
...
@@ -53,7 +52,7 @@ static av_cold int ra144_encode_init(AVCodecContext * avctx)
ractx
->
lpc_coef
[
0
]
=
ractx
->
lpc_tables
[
0
];
ractx
->
lpc_coef
[
1
]
=
ractx
->
lpc_tables
[
1
];
ractx
->
avctx
=
avctx
;
dsputil_init
(
&
ractx
->
dsp
,
av
ctx
);
ff_lpc_init
(
&
ractx
->
lpc_
ctx
);
return
0
;
}
...
...
@@ -451,7 +450,7 @@ static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame,
energy
=
ff_energy_tab
[
quantize
(
ff_t_sqrt
(
energy
>>
5
)
>>
10
,
ff_energy_tab
,
32
)];
ff_lpc_calc_coefs
(
&
ractx
->
dsp
,
lpc_data
,
NBLOCKS
*
BLOCKSIZE
,
LPC_ORDER
,
ff_lpc_calc_coefs
(
&
ractx
->
lpc_ctx
,
lpc_data
,
NBLOCKS
*
BLOCKSIZE
,
LPC_ORDER
,
LPC_ORDER
,
16
,
lpc_coefs
,
shift
,
AV_LPC_TYPE_LEVINSON
,
0
,
ORDER_METHOD_EST
,
12
,
0
);
for
(
i
=
0
;
i
<
LPC_ORDER
;
i
++
)
...
...
libavcodec/x86/dsputil_mmx.h
View file @
56f8952b
...
...
@@ -200,9 +200,6 @@ void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx);
void
ff_put_vc1_mspel_mc00_mmx
(
uint8_t
*
dst
,
const
uint8_t
*
src
,
int
stride
,
int
rnd
);
void
ff_avg_vc1_mspel_mc00_mmx2
(
uint8_t
*
dst
,
const
uint8_t
*
src
,
int
stride
,
int
rnd
);
void
ff_lpc_compute_autocorr_sse2
(
const
int32_t
*
data
,
int
len
,
int
lag
,
double
*
autoc
);
void
ff_mmx_idct
(
DCTELEM
*
block
);
void
ff_mmxext_idct
(
DCTELEM
*
block
);
...
...
libavcodec/x86/dsputilenc_mmx.c
View file @
56f8952b
...
...
@@ -1166,10 +1166,6 @@ void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
#endif
}
if
(
CONFIG_LPC
&&
mm_flags
&
(
AV_CPU_FLAG_SSE2
|
AV_CPU_FLAG_SSE2SLOW
))
{
c
->
lpc_compute_autocorr
=
ff_lpc_compute_autocorr_sse2
;
}
#if HAVE_SSSE3
if
(
mm_flags
&
AV_CPU_FLAG_SSSE3
){
if
(
!
(
avctx
->
flags
&
CODEC_FLAG_BITEXACT
)){
...
...
libavcodec/x86/lpc_mmx.c
View file @
56f8952b
...
...
@@ -20,7 +20,8 @@
*/
#include "libavutil/x86_cpu.h"
#include "dsputil_mmx.h"
#include "libavutil/cpu.h"
#include "libavcodec/lpc.h"
static
void
apply_welch_window_sse2
(
const
int32_t
*
data
,
int
len
,
double
*
w_data
)
{
...
...
@@ -68,7 +69,7 @@ static void apply_welch_window_sse2(const int32_t *data, int len, double *w_data
#undef WELCH
}
void
ff_
lpc_compute_autocorr_sse2
(
const
int32_t
*
data
,
int
len
,
int
lag
,
static
void
lpc_compute_autocorr_sse2
(
const
int32_t
*
data
,
int
len
,
int
lag
,
double
*
autoc
)
{
double
tmp
[
len
+
lag
+
2
];
...
...
@@ -141,3 +142,12 @@ void ff_lpc_compute_autocorr_sse2(const int32_t *data, int len, int lag,
}
}
}
av_cold
void
ff_lpc_init_x86
(
LPCContext
*
c
)
{
int
mm_flags
=
av_get_cpu_flags
();
if
(
mm_flags
&
(
AV_CPU_FLAG_SSE2
|
AV_CPU_FLAG_SSE2SLOW
))
{
c
->
lpc_compute_autocorr
=
lpc_compute_autocorr_sse2
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment