Skip to content
Snippets Groups Projects
Verified Commit c8a36592 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

No longer include pointers in the SILK structs

Everything can now be shallow-copied again
parent 71d5edcf
Branches opus-ng-neonwarningfix
No related tags found
No related merge requests found
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef DRED_CONFIG_H
#define DRED_CONFIG_H
#define DRED_VERSION 0 #define DRED_VERSION 0
#define DRED_MIN_BYTES 16 #define DRED_MIN_BYTES 16
...@@ -32,7 +35,6 @@ ...@@ -32,7 +35,6 @@
#define DRED_NUM_FEATURES 20 #define DRED_NUM_FEATURES 20
#define DRED_LATENT_DIM 80 #define DRED_LATENT_DIM 80
#define DRED_STATE_DIM 24 #define DRED_STATE_DIM 24
#define DRED_NUM_QUANTIZATION_LEVELS 40
#define DRED_MAX_FRAMES 100 #define DRED_MAX_FRAMES 100
#define DRED_SILK_ENCODER_DELAY 79 #define DRED_SILK_ENCODER_DELAY 79
#define DRED_FRAME_SIZE 160 #define DRED_FRAME_SIZE 160
...@@ -41,3 +43,5 @@ ...@@ -41,3 +43,5 @@
#define DRED_ENC_Q0 9 #define DRED_ENC_Q0 9
#define DRED_ENC_Q1 15 #define DRED_ENC_Q1 15
#define DRED_NUM_REDUNDANCY_FRAMES 50 #define DRED_NUM_REDUNDANCY_FRAMES 50
#endif
...@@ -45,8 +45,8 @@ ...@@ -45,8 +45,8 @@
void init_dred_encoder(DREDEnc* enc) void init_dred_encoder(DREDEnc* enc)
{ {
memset(enc, 0, sizeof(*enc)); memset(enc, 0, sizeof(*enc));
enc->lpcnet_enc_state = lpcnet_encoder_create(); lpcnet_encoder_init(&enc->lpcnet_enc_state);
enc->rdovae_enc = DRED_rdovae_create_encoder(); DRED_rdovae_init_encoder(&enc->rdovae_enc);
} }
void dred_process_silk_frame(DREDEnc *enc, const opus_int16 *silk_frame) void dred_process_silk_frame(DREDEnc *enc, const opus_int16 *silk_frame)
...@@ -62,15 +62,15 @@ void dred_process_silk_frame(DREDEnc *enc, const opus_int16 *silk_frame) ...@@ -62,15 +62,15 @@ void dred_process_silk_frame(DREDEnc *enc, const opus_int16 *silk_frame)
memmove(enc->latents_buffer + DRED_LATENT_DIM, enc->latents_buffer, (DRED_MAX_FRAMES - 1) * DRED_LATENT_DIM * sizeof(*enc->latents_buffer)); memmove(enc->latents_buffer + DRED_LATENT_DIM, enc->latents_buffer, (DRED_MAX_FRAMES - 1) * DRED_LATENT_DIM * sizeof(*enc->latents_buffer));
/* calculate LPCNet features */ /* calculate LPCNet features */
lpcnet_compute_single_frame_features(enc->lpcnet_enc_state, enc->input_buffer, feature_buffer); lpcnet_compute_single_frame_features(&enc->lpcnet_enc_state, enc->input_buffer, feature_buffer);
lpcnet_compute_single_frame_features(enc->lpcnet_enc_state, enc->input_buffer + DRED_FRAME_SIZE, feature_buffer + 36); lpcnet_compute_single_frame_features(&enc->lpcnet_enc_state, enc->input_buffer + DRED_FRAME_SIZE, feature_buffer + 36);
/* prepare input buffer (discard LPC coefficients) */ /* prepare input buffer (discard LPC coefficients) */
memcpy(input_buffer, feature_buffer, DRED_NUM_FEATURES * sizeof(input_buffer[0])); memcpy(input_buffer, feature_buffer, DRED_NUM_FEATURES * sizeof(input_buffer[0]));
memcpy(input_buffer + DRED_NUM_FEATURES, feature_buffer + 36, DRED_NUM_FEATURES * sizeof(input_buffer[0])); memcpy(input_buffer + DRED_NUM_FEATURES, feature_buffer + 36, DRED_NUM_FEATURES * sizeof(input_buffer[0]));
/* run RDOVAE encoder */ /* run RDOVAE encoder */
DRED_rdovae_encode_dframe(enc->rdovae_enc, enc->latents_buffer, enc->state_buffer, input_buffer); DRED_rdovae_encode_dframe(&enc->rdovae_enc, enc->latents_buffer, enc->state_buffer, input_buffer);
enc->latents_buffer_fill = IMIN(enc->latents_buffer_fill+1, DRED_NUM_REDUNDANCY_FRAMES); enc->latents_buffer_fill = IMIN(enc->latents_buffer_fill+1, DRED_NUM_REDUNDANCY_FRAMES);
} }
......
...@@ -32,7 +32,8 @@ ...@@ -32,7 +32,8 @@
#include "dred_config.h" #include "dred_config.h"
#include "dred_rdovae.h" #include "dred_rdovae.h"
#include "entcode.h" #include "entcode.h"
#include "lpcnet/src/lpcnet_private.h"
#include "lpcnet/src/dred_rdovae_enc.h"
typedef struct { typedef struct {
...@@ -40,8 +41,8 @@ typedef struct { ...@@ -40,8 +41,8 @@ typedef struct {
float latents_buffer[DRED_MAX_FRAMES * DRED_LATENT_DIM]; float latents_buffer[DRED_MAX_FRAMES * DRED_LATENT_DIM];
int latents_buffer_fill; int latents_buffer_fill;
float state_buffer[24]; float state_buffer[24];
LPCNetEncState *lpcnet_enc_state; LPCNetEncState lpcnet_enc_state;
RDOVAEEnc *rdovae_enc; RDOVAEEnc rdovae_enc;
} DREDEnc; } DREDEnc;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment