summaryrefslogtreecommitdiff
path: root/amadec/audio_out/aml_resample.h (plain)
blob: 150cbff0e605f76839d94b846887ea99c9426c4e
1
2#ifndef __AML_RESAMPLE_H__
3#define __AML_RESAMPLE_H__
4
5#include <audio-dec.h>
6#include <adec-pts-mgt.h>
7#include <audiodsp_update_format.h>
8#define Q14(ratio) ((ratio)*(1<<14))
9#define Q14_INT_GET(value) ((value)>>14)
10#define Q14_FRA_GET(value) ((value)&0x3fff)
11
12#define RESAMPLE_DELTA_NUMSAMPS 1
13#define DEFALT_NUMSAMPS_PERCH 128
14#define MAX_NUMSAMPS_PERCH (DEFALT_NUMSAMPS_PERCH + RESAMPLE_DELTA_NUMSAMPS)
15#define DEFALT_NUMCH 2
16
17#define RESAMPLE_TYPE_NONE 0
18#define RESAMPLE_TYPE_DOWN 1
19#define RESAMPLE_TYPE_UP 2
20
21#define RESAMPLE_DOWN_FORCE_PCR_SLOW 3
22
23typedef struct af_resampe_ctl_s {
24 int SampNumIn;
25 int SampNumOut;
26 int InterpolateCoefArray[MAX_NUMSAMPS_PERCH];
27 short InterpolateIndexArray[MAX_NUMSAMPS_PERCH];
28 short ResevedBuf[MAX_NUMSAMPS_PERCH*DEFALT_NUMCH];
29 short ResevedSampsValid;
30 short OutSampReserveBuf[MAX_NUMSAMPS_PERCH*DEFALT_NUMCH];
31 short OutSampReserveLen;
32 short InitFlag;
33 short LastResamType;
34 int resample_type;
35 short enable_resample;
36} af_resampe_ctl_t;
37
38void af_resample_linear_init(struct aml_audio_dec* audec);
39
40void af_resample_linear_stop(struct aml_audio_dec* audec);
41
42int af_get_resample_enable_flag();
43
44af_resampe_ctl_t* af_resampler_ctx_get();
45
46void af_resample_set_SampsNumRatio(af_resampe_ctl_t *paf_resampe_ctl);
47
48void af_get_pcm_in_resampler(af_resampe_ctl_t *paf_resampe_ctl, short*buf, int *len);
49
50
51void af_resample_process_linear_inner(af_resampe_ctl_t *paf_resampe_ctl,
52 short *data_in, int *NumSamp_in,
53 short* data_out, int* NumSamp_out, int NumCh);
54void af_resample_stop_process(af_resampe_ctl_t *paf_resampe_ctl);
55
56
57int af_get_delta_inputsampnum(af_resampe_ctl_t *paf_resampe_ctl, int Nch);
58
59void af_get_unpro_inputsampnum(af_resampe_ctl_t *paf_resampe_ctl, short *buf, int *num);
60
61void af_resample_api_normal(char *buffer, unsigned int *size, int Chnum, aml_audio_dec_t *audec);
62
63void af_resample_api(char* buffer, unsigned int * size, int Chnum, aml_audio_dec_t* audec, int enable, int delta);
64
65int af_set_resample_type(int val);
66
67void af_pcrmaster_resample_api(char *buffer, unsigned int *size, int Chnum, aml_audio_dec_t *audec/*, int enable, int delta*/);
68
69#endif
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87