mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 11:24:05 +00:00
correct memory allocation
This commit is contained in:
parent
da3e2d1d07
commit
ea82c38906
|
@ -124,9 +124,7 @@ static void encoder_state_config_tile_finalize(encoder_state_t * const state) {
|
|||
|
||||
kvz_videoframe_free(state->tile->frame);
|
||||
state->tile->frame = NULL;
|
||||
if (state->encoder_control->cfg->crypto_features) {
|
||||
DeleteCryptoC(state->tile->dbs_g);
|
||||
}
|
||||
DeleteCryptoC(state->tile->dbs_g);
|
||||
FREE_POINTER(state->tile->wf_jobs);
|
||||
}
|
||||
|
||||
|
@ -320,6 +318,8 @@ int kvz_encoder_state_init(encoder_state_t * const child_state, encoder_state_t
|
|||
fprintf(stderr, "Could not initialize encoder_state->tile!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
child_state->tile->dbs_g = CreateC();
|
||||
child_state->slice = MALLOC(encoder_state_config_slice_t, 1);
|
||||
if (!child_state->slice || !encoder_state_config_slice_init(child_state, 0, encoder->in.width_in_lcu * encoder->in.height_in_lcu - 1)) {
|
||||
fprintf(stderr, "Could not initialize encoder_state->slice!\n");
|
||||
|
@ -449,6 +449,7 @@ int kvz_encoder_state_init(encoder_state_t * const child_state, encoder_state_t
|
|||
new_child->type = ENCODER_STATE_TYPE_TILE;
|
||||
new_child->frame = child_state->frame;
|
||||
new_child->tile = MALLOC(encoder_state_config_tile_t, 1);
|
||||
new_child->tile->dbs_g = CreateC();
|
||||
new_child->slice = child_state->slice;
|
||||
new_child->wfrow = child_state->wfrow;
|
||||
|
||||
|
|
|
@ -298,8 +298,7 @@ static void encoder_state_encode_leaf(encoder_state_t * const state) {
|
|||
|
||||
const kvz_config *cfg = state->encoder_control->cfg;
|
||||
if ( state->encoder_control->cfg->crypto_features) {
|
||||
DeleteCryptoC(state->tile->dbs_g);
|
||||
state->tile->dbs_g = InitC();
|
||||
InitC(state->tile->dbs_g);
|
||||
state->tile->m_prev_pos = 0;
|
||||
}
|
||||
// Select whether to encode the frame/tile in current thread or to define
|
||||
|
|
|
@ -19,9 +19,12 @@ typedef struct AESDecoder {
|
|||
} AESDecoder;
|
||||
|
||||
|
||||
AESDecoder* Init() {
|
||||
AESDecoder* Create() {
|
||||
AESDecoder * AESdecoder = (AESDecoder *)malloc(sizeof(AESDecoder));
|
||||
return AESdecoder;
|
||||
}
|
||||
void Init(AESDecoder* AESdecoder) {
|
||||
int init_val[32] = {201, 75, 219, 152, 6, 245, 237, 107, 179, 194, 81, 29, 66, 98, 198, 0, 16, 213, 27, 56, 255, 127, 242, 112, 97, 126, 197, 204, 25, 59, 38, 30};
|
||||
AESDecoder * AESdecoder = (AESDecoder *)malloc(sizeof(AESDecoder));
|
||||
for(int i=0;i<16; i++) {
|
||||
AESdecoder->iv [i] = init_val[i];
|
||||
AESdecoder->counter[i] = init_val[5+i];
|
||||
|
@ -35,7 +38,6 @@ AESDecoder* Init() {
|
|||
AESdecoder->couter_avail = 0;
|
||||
AESdecoder->counter_index = 0;
|
||||
AESdecoder->counter_index_pos = 0;
|
||||
return AESdecoder;
|
||||
}
|
||||
|
||||
void DeleteCrypto(AESDecoder * AESdecoder) {
|
||||
|
@ -105,11 +107,15 @@ unsigned int get_key (AESDecoder * AESdecoder, int nb_bits) {
|
|||
return key_;
|
||||
}
|
||||
#endif
|
||||
|
||||
Crypto_Handle InitC(){
|
||||
AESDecoder* AESdecoder = Init();
|
||||
return AESdecoder;
|
||||
Crypto_Handle CreateC() {
|
||||
AESDecoder* AESdecoder = Create();
|
||||
return AESdecoder;
|
||||
}
|
||||
|
||||
void InitC(Crypto_Handle hdl) {
|
||||
Init((AESDecoder*)hdl);
|
||||
}
|
||||
|
||||
#if AESEncryptionStreamMode
|
||||
unsigned int ff_get_key (Crypto_Handle *hdl, int nb_bits) {
|
||||
return get_key ((AESDecoder*)*hdl, nb_bits);
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
typedef void* Crypto_Handle;
|
||||
|
||||
STUBBED Crypto_Handle InitC();
|
||||
STUBBED Crypto_Handle CreateC();
|
||||
STUBBED void InitC(Crypto_Handle hdl);
|
||||
STUBBED void DecryptC(Crypto_Handle hdl, const unsigned char *in_stream, int size_bits, unsigned char *out_stream);
|
||||
#if AESEncryptionStreamMode
|
||||
STUBBED unsigned int ff_get_key(Crypto_Handle *hdl, int nb_bits);
|
||||
|
@ -38,11 +38,12 @@ extern "C" {
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
static INLINE Crypto_Handle InitC()
|
||||
{
|
||||
// Stub.
|
||||
assert(0);
|
||||
return 0;
|
||||
static INLINE Crypto_Handle CreateC() {
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
static INLINE void InitC(Crypto_Handle hdl) {
|
||||
assert(0);
|
||||
}
|
||||
|
||||
static INLINE void DecryptC(Crypto_Handle hdl, const unsigned char *in_stream,
|
||||
|
|
Loading…
Reference in a new issue