00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef __DRM_DEC_H__
00034 #define __DRM_DEC_H__
00035
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039
00040 #include "bits.h"
00041
00042 #define DRM_PARAMETRIC_STEREO 0
00043 #define DRM_NUM_SA_BANDS 8
00044 #define DRM_NUM_PAN_BANDS 20
00045 #define NUM_OF_LINKS 3
00046 #define NUM_OF_QMF_CHANNELS 64
00047 #define NUM_OF_SUBSAMPLES 30
00048 #define MAX_SA_BAND 46
00049 #define MAX_PAN_BAND 64
00050 #define MAX_DELAY 5
00051
00052 typedef struct
00053 {
00054 uint8_t drm_ps_data_available;
00055 uint8_t bs_enable_sa;
00056 uint8_t bs_enable_pan;
00057
00058 uint8_t bs_sa_dt_flag;
00059 uint8_t bs_pan_dt_flag;
00060
00061 uint8_t g_last_had_sa;
00062 uint8_t g_last_had_pan;
00063
00064 int8_t bs_sa_data[DRM_NUM_SA_BANDS];
00065 int8_t bs_pan_data[DRM_NUM_PAN_BANDS];
00066
00067 int8_t g_sa_index[DRM_NUM_SA_BANDS];
00068 int8_t g_pan_index[DRM_NUM_PAN_BANDS];
00069 int8_t g_prev_sa_index[DRM_NUM_SA_BANDS];
00070 int8_t g_prev_pan_index[DRM_NUM_PAN_BANDS];
00071
00072 int8_t sa_decode_error;
00073 int8_t pan_decode_error;
00074
00075 int8_t g_last_good_sa_index[DRM_NUM_SA_BANDS];
00076 int8_t g_last_good_pan_index[DRM_NUM_PAN_BANDS];
00077
00078 qmf_t SA[NUM_OF_SUBSAMPLES][MAX_SA_BAND];
00079
00080 complex_t d_buff[2][MAX_SA_BAND];
00081 complex_t d2_buff[NUM_OF_LINKS][MAX_DELAY][MAX_SA_BAND];
00082
00083 uint8_t delay_buf_index_ser[NUM_OF_LINKS];
00084
00085 real_t prev_nrg[MAX_SA_BAND];
00086 real_t prev_peakdiff[MAX_SA_BAND];
00087 real_t peakdecay_fast[MAX_SA_BAND];
00088 } drm_ps_info;
00089
00090
00091 uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld);
00092
00093 drm_ps_info *drm_ps_init(void);
00094 void drm_ps_free(drm_ps_info *ps);
00095
00096 uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, qmf_t X_left[38][64], qmf_t X_right[38][64]);
00097
00098 #ifdef __cplusplus
00099 }
00100 #endif
00101 #endif
00102