Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
b08fab88
Commit
b08fab88
authored
Sep 02, 2014
by
Dmitry Kovalev
Browse files
Consistent allocation of vpx_codec_alg_priv_t.
Change-Id: I5a03496de035fbcf31e4527cd25fcae4627a57a0
parent
0ecc75c8
Changes
4
Hide whitespace changes
Inline
Side-by-side
vp8/vp8_cx_iface.c
View file @
b08fab88
...
...
@@ -14,6 +14,7 @@
#include
"vpx/vpx_codec.h"
#include
"vpx/internal/vpx_codec_internal.h"
#include
"vpx_version.h"
#include
"vpx_mem/vpx_mem.h"
#include
"vp8/encoder/onyx_int.h"
#include
"vpx/vp8cx.h"
#include
"vp8/encoder/firstpass.h"
...
...
@@ -619,13 +620,14 @@ static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx,
vpx_codec_priv_enc_mr_cfg_t
*
mr_cfg
)
{
vpx_codec_err_t
res
=
VPX_CODEC_OK
;
struct
vpx_codec_alg_priv
*
priv
;
vp8_rtcd
();
if
(
!
ctx
->
priv
)
{
priv
=
calloc
(
1
,
sizeof
(
struct
vpx_codec_alg_priv
));
struct
vpx_codec_alg_priv
*
priv
=
(
struct
vpx_codec_alg_priv
*
)
vpx_calloc
(
1
,
sizeof
(
*
priv
));
if
(
!
priv
)
{
...
...
@@ -633,7 +635,7 @@ static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx,
}
ctx
->
priv
=
(
vpx_codec_priv_t
*
)
priv
;
ctx
->
priv
->
sz
=
sizeof
(
struct
vpx_codec_alg_
priv
);
ctx
->
priv
->
sz
=
sizeof
(
*
priv
);
ctx
->
priv
->
init_flags
=
ctx
->
init_flags
;
if
(
ctx
->
config
.
enc
)
...
...
@@ -692,7 +694,7 @@ static vpx_codec_err_t vp8e_destroy(vpx_codec_alg_priv_t *ctx)
free
(
ctx
->
cx_data
);
vp8_remove_compressor
(
&
ctx
->
cpi
);
free
(
ctx
);
vpx_
free
(
ctx
);
return
VPX_CODEC_OK
;
}
...
...
vp8/vp8_dx_iface.c
View file @
b08fab88
...
...
@@ -81,11 +81,10 @@ static unsigned long vp8_priv_sz(const vpx_codec_dec_cfg_t *si, vpx_codec_flags_
static
void
vp8_init_ctx
(
vpx_codec_ctx_t
*
ctx
)
{
vpx_codec_alg_priv_t
*
priv
=
(
vpx_codec_alg_priv_t
*
)
vpx_memalign
(
8
,
sizeof
(
*
priv
));
vpx_memset
(
priv
,
0
,
sizeof
(
*
priv
));
(
vpx_codec_alg_priv_t
*
)
vpx_calloc
(
1
,
sizeof
(
*
priv
));
ctx
->
priv
=
(
vpx_codec_priv_t
*
)
priv
;
ctx
->
priv
->
sz
=
sizeof
(
*
ctx
->
priv
);
ctx
->
priv
->
sz
=
sizeof
(
*
priv
);
ctx
->
priv
->
init_flags
=
ctx
->
init_flags
;
priv
->
si
.
sz
=
sizeof
(
priv
->
si
);
...
...
vp9/vp9_cx_iface.c
View file @
b08fab88
...
...
@@ -654,34 +654,33 @@ static vpx_codec_err_t encoder_init(vpx_codec_ctx_t *ctx,
(
void
)
data
;
if
(
ctx
->
priv
==
NULL
)
{
vpx_codec_alg_priv_t
*
const
alg_priv
=
calloc
(
1
,
sizeof
(
*
alg_priv
));
if
(
alg_priv
==
NULL
)
vpx_codec_alg_priv_t
*
const
priv
=
vpx_calloc
(
1
,
sizeof
(
*
priv
));
if
(
priv
==
NULL
)
return
VPX_CODEC_MEM_ERROR
;
ctx
->
priv
=
(
vpx_codec_priv_t
*
)
alg_
priv
;
ctx
->
priv
->
sz
=
sizeof
(
vpx_codec_alg_
priv
_t
);
ctx
->
priv
=
(
vpx_codec_priv_t
*
)
priv
;
ctx
->
priv
->
sz
=
sizeof
(
*
priv
);
ctx
->
priv
->
init_flags
=
ctx
->
init_flags
;
ctx
->
priv
->
enc
.
total_encoders
=
1
;
if
(
ctx
->
config
.
enc
)
{
// Update the reference to the config structure to an internal copy.
alg_
priv
->
cfg
=
*
ctx
->
config
.
enc
;
ctx
->
config
.
enc
=
&
alg_
priv
->
cfg
;
priv
->
cfg
=
*
ctx
->
config
.
enc
;
ctx
->
config
.
enc
=
&
priv
->
cfg
;
}
alg_
priv
->
extra_cfg
=
default_extra_cfg
;
priv
->
extra_cfg
=
default_extra_cfg
;
vp9_initialize_enc
();
res
=
validate_config
(
alg_
priv
,
&
alg_
priv
->
cfg
,
&
alg_
priv
->
extra_cfg
);
res
=
validate_config
(
priv
,
&
priv
->
cfg
,
&
priv
->
extra_cfg
);
if
(
res
==
VPX_CODEC_OK
)
{
set_encoder_config
(
&
alg_
priv
->
oxcf
,
&
alg_
priv
->
cfg
,
&
alg_
priv
->
extra_cfg
);
alg_
priv
->
cpi
=
vp9_create_compressor
(
&
alg_
priv
->
oxcf
);
if
(
alg_
priv
->
cpi
==
NULL
)
set_encoder_config
(
&
priv
->
oxcf
,
&
priv
->
cfg
,
&
priv
->
extra_cfg
);
priv
->
cpi
=
vp9_create_compressor
(
&
priv
->
oxcf
);
if
(
priv
->
cpi
==
NULL
)
res
=
VPX_CODEC_MEM_ERROR
;
else
alg_
priv
->
cpi
->
output_pkt_list
=
&
alg_
priv
->
pkt_list
.
head
;
priv
->
cpi
->
output_pkt_list
=
&
priv
->
pkt_list
.
head
;
}
}
...
...
@@ -691,7 +690,7 @@ static vpx_codec_err_t encoder_init(vpx_codec_ctx_t *ctx,
static
vpx_codec_err_t
encoder_destroy
(
vpx_codec_alg_priv_t
*
ctx
)
{
free
(
ctx
->
cx_data
);
vp9_remove_compressor
(
ctx
->
cpi
);
free
(
ctx
);
vpx_
free
(
ctx
);
return
VPX_CODEC_OK
;
}
...
...
vp9/vp9_dx_iface.c
View file @
b08fab88
...
...
@@ -58,25 +58,23 @@ static vpx_codec_err_t decoder_init(vpx_codec_ctx_t *ctx,
(
void
)
data
;
if
(
!
ctx
->
priv
)
{
vpx_codec_alg_priv_t
*
const
alg_
priv
=
vpx_
memalign
(
32
,
sizeof
(
*
alg_
priv
));
if
(
alg_
priv
==
NULL
)
vpx_codec_alg_priv_t
*
const
priv
=
vpx_
calloc
(
1
,
sizeof
(
*
priv
));
if
(
priv
==
NULL
)
return
VPX_CODEC_MEM_ERROR
;
vp9_zero
(
*
alg_priv
);
ctx
->
priv
=
(
vpx_codec_priv_t
*
)
alg_priv
;
ctx
->
priv
->
sz
=
sizeof
(
*
alg_priv
);
ctx
->
priv
=
(
vpx_codec_priv_t
*
)
priv
;
ctx
->
priv
->
sz
=
sizeof
(
*
priv
);
ctx
->
priv
->
init_flags
=
ctx
->
init_flags
;
alg_
priv
->
si
.
sz
=
sizeof
(
alg_
priv
->
si
);
alg_
priv
->
flushed
=
0
;
alg_
priv
->
frame_parallel_decode
=
priv
->
si
.
sz
=
sizeof
(
priv
->
si
);
priv
->
flushed
=
0
;
priv
->
frame_parallel_decode
=
(
ctx
->
init_flags
&
VPX_CODEC_USE_FRAME_THREADING
);
alg_
priv
->
frame_parallel_decode
=
0
;
// Disable for now
priv
->
frame_parallel_decode
=
0
;
// Disable for now
if
(
ctx
->
config
.
dec
)
{
alg_
priv
->
cfg
=
*
ctx
->
config
.
dec
;
ctx
->
config
.
dec
=
&
alg_
priv
->
cfg
;
priv
->
cfg
=
*
ctx
->
config
.
dec
;
ctx
->
config
.
dec
=
&
priv
->
cfg
;
}
}
...
...
Write
Preview
Supports
Markdown
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