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
47cc2559
Commit
47cc2559
authored
Jan 23, 2018
by
Sean DuBois
Browse files
Remove deadline
BUG=aomedia:13 Change-Id: I9df343f4a6a809b09446ff1f2083c38771ab068b
parent
913867b4
Changes
32
Hide whitespace changes
Inline
Side-by-side
aom/aom_decoder.h
View file @
47cc2559
...
...
@@ -203,8 +203,6 @@ aom_codec_err_t aom_codec_get_stream_info(aom_codec_ctx_t *ctx,
* \param[in] data_sz Size of the coded data, in bytes.
* \param[in] user_priv Application specific data to associate with
* this frame.
* \param[in] deadline Soft deadline the decoder should attempt to meet,
* in us. Set to zero for unlimited.
*
* \return Returns #AOM_CODEC_OK if the coded data was processed completely
* and future pictures can be decoded without error. Otherwise,
...
...
@@ -212,8 +210,7 @@ aom_codec_err_t aom_codec_get_stream_info(aom_codec_ctx_t *ctx,
* for recoverability capabilities.
*/
aom_codec_err_t
aom_codec_decode
(
aom_codec_ctx_t
*
ctx
,
const
uint8_t
*
data
,
unsigned
int
data_sz
,
void
*
user_priv
,
long
deadline
);
unsigned
int
data_sz
,
void
*
user_priv
);
/*!\brief Decoded frames iterator
*
...
...
aom/aom_encoder.h
View file @
47cc2559
...
...
@@ -789,23 +789,11 @@ aom_codec_err_t aom_codec_enc_config_set(aom_codec_ctx_t *ctx,
*/
aom_fixed_buf_t
*
aom_codec_get_global_headers
(
aom_codec_ctx_t
*
ctx
);
/*!\brief deadline parameter analogous to AVx GOOD QUALITY mode. */
#define AOM_DL_GOOD_QUALITY (1000000)
/*!\brief Encode a frame
*
* Encodes a video frame at the given "presentation time." The presentation
* time stamp (PTS) \ref MUST be strictly increasing.
*
* The encoder supports the notion of a soft real-time deadline. Given a
* non-zero value to the deadline parameter, the encoder will make a "best
* effort" guarantee to return before the given time slice expires. It is
* implicit that limiting the available time to encode will degrade the
* output quality. The encoder can be given an unlimited time to produce the
* best possible frame by specifying a deadline of '0'. This deadline
* supercedes the AVx notion of "best quality, good quality, realtime".
* Applications that wish to map these former settings to the new deadline
* based system can use the symbol #AOM_DL_GOOD_QUALITY.
*
* When the last frame has been passed to the encoder, this function should
* continue to be called, with the img parameter set to NULL. This will
* signal the end-of-stream condition to the encoder and allow it to encode
...
...
@@ -817,7 +805,6 @@ aom_fixed_buf_t *aom_codec_get_global_headers(aom_codec_ctx_t *ctx);
* \param[in] pts Presentation time stamp, in timebase units.
* \param[in] duration Duration to show frame, in timebase units.
* \param[in] flags Flags to use for encoding this frame.
* \param[in] deadline Time to spend encoding, in microseconds. (0=infinite)
*
* \retval #AOM_CODEC_OK
* The configuration was populated.
...
...
@@ -828,8 +815,7 @@ aom_fixed_buf_t *aom_codec_get_global_headers(aom_codec_ctx_t *ctx);
*/
aom_codec_err_t
aom_codec_encode
(
aom_codec_ctx_t
*
ctx
,
const
aom_image_t
*
img
,
aom_codec_pts_t
pts
,
unsigned
long
duration
,
aom_enc_frame_flags_t
flags
,
unsigned
long
deadline
);
aom_enc_frame_flags_t
flags
);
/*!\brief Set compressed data output buffer
*
...
...
aom/internal/aom_codec_internal.h
View file @
47cc2559
...
...
@@ -196,8 +196,7 @@ typedef const struct aom_codec_ctrl_fn_map {
typedef
aom_codec_err_t
(
*
aom_codec_decode_fn_t
)(
aom_codec_alg_priv_t
*
ctx
,
const
uint8_t
*
data
,
unsigned
int
data_sz
,
void
*
user_priv
,
long
deadline
);
void
*
user_priv
);
/*!\brief Decoded frames iterator
*
...
...
@@ -252,8 +251,7 @@ typedef aom_codec_err_t (*aom_codec_encode_fn_t)(aom_codec_alg_priv_t *ctx,
const
aom_image_t
*
img
,
aom_codec_pts_t
pts
,
unsigned
long
duration
,
aom_enc_frame_flags_t
flags
,
unsigned
long
deadline
);
aom_enc_frame_flags_t
flags
);
typedef
const
aom_codec_cx_pkt_t
*
(
*
aom_codec_get_cx_data_fn_t
)(
aom_codec_alg_priv_t
*
ctx
,
aom_codec_iter_t
*
iter
);
...
...
aom/src/aom_decoder.c
View file @
47cc2559
...
...
@@ -99,8 +99,7 @@ aom_codec_err_t aom_codec_get_stream_info(aom_codec_ctx_t *ctx,
}
aom_codec_err_t
aom_codec_decode
(
aom_codec_ctx_t
*
ctx
,
const
uint8_t
*
data
,
unsigned
int
data_sz
,
void
*
user_priv
,
long
deadline
)
{
unsigned
int
data_sz
,
void
*
user_priv
)
{
aom_codec_err_t
res
;
/* Sanity checks */
...
...
@@ -110,8 +109,7 @@ aom_codec_err_t aom_codec_decode(aom_codec_ctx_t *ctx, const uint8_t *data,
else
if
(
!
ctx
->
iface
||
!
ctx
->
priv
)
res
=
AOM_CODEC_ERROR
;
else
{
res
=
ctx
->
iface
->
dec
.
decode
(
get_alg_priv
(
ctx
),
data
,
data_sz
,
user_priv
,
deadline
);
res
=
ctx
->
iface
->
dec
.
decode
(
get_alg_priv
(
ctx
),
data
,
data_sz
,
user_priv
);
}
return
SAVE_STATUS
(
ctx
,
res
);
...
...
aom/src/aom_encoder.c
View file @
47cc2559
...
...
@@ -213,8 +213,7 @@ aom_codec_err_t aom_codec_enc_config_default(aom_codec_iface_t *iface,
aom_codec_err_t
aom_codec_encode
(
aom_codec_ctx_t
*
ctx
,
const
aom_image_t
*
img
,
aom_codec_pts_t
pts
,
unsigned
long
duration
,
aom_enc_frame_flags_t
flags
,
unsigned
long
deadline
)
{
aom_enc_frame_flags_t
flags
)
{
aom_codec_err_t
res
=
AOM_CODEC_OK
;
if
(
!
ctx
||
(
img
&&
!
duration
))
...
...
@@ -232,8 +231,8 @@ aom_codec_err_t aom_codec_encode(aom_codec_ctx_t *ctx, const aom_image_t *img,
FLOATING_POINT_INIT
if
(
num_enc
==
1
)
res
=
ctx
->
iface
->
enc
.
encode
(
get_alg_priv
(
ctx
),
img
,
pts
,
duration
,
flags
,
deadline
);
res
=
ctx
->
iface
->
enc
.
encode
(
get_alg_priv
(
ctx
),
img
,
pts
,
duration
,
flags
);
else
{
/* Multi-resolution encoding:
* Encode multi-levels in reverse order. For example,
...
...
@@ -247,7 +246,7 @@ aom_codec_err_t aom_codec_encode(aom_codec_ctx_t *ctx, const aom_image_t *img,
for
(
i
=
num_enc
-
1
;
i
>=
0
;
i
--
)
{
if
((
res
=
ctx
->
iface
->
enc
.
encode
(
get_alg_priv
(
ctx
),
img
,
pts
,
duration
,
flags
,
deadline
)))
flags
)))
break
;
ctx
--
;
...
...
aomdec.c
View file @
47cc2559
...
...
@@ -790,8 +790,8 @@ static int main_loop(int argc, const char **argv_) {
aom_usec_timer_start
(
&
timer
);
if
(
aom_codec_decode
(
&
decoder
,
buf
,
(
unsigned
int
)
bytes_in_buffer
,
NULL
,
0
))
{
if
(
aom_codec_decode
(
&
decoder
,
buf
,
(
unsigned
int
)
bytes_in_buffer
,
NULL
))
{
const
char
*
detail
=
aom_codec_error_detail
(
&
decoder
);
warn
(
"Failed to decode frame %d: %s"
,
frame_in
,
aom_codec_error
(
&
decoder
));
...
...
@@ -823,7 +823,7 @@ static int main_loop(int argc, const char **argv_) {
if
(
flush_decoder
)
{
// Flush the decoder in frame parallel decode.
if
(
aom_codec_decode
(
&
decoder
,
NULL
,
0
,
NULL
,
0
))
{
if
(
aom_codec_decode
(
&
decoder
,
NULL
,
0
,
NULL
))
{
warn
(
"Failed to flush decoder: %s"
,
aom_codec_error
(
&
decoder
));
}
}
...
...
aomenc.c
View file @
47cc2559
...
...
@@ -157,10 +157,6 @@ static const arg_def_t limit =
ARG_DEF
(
NULL
,
"limit"
,
1
,
"Stop encoding after n input frames"
);
static
const
arg_def_t
skip
=
ARG_DEF
(
NULL
,
"skip"
,
1
,
"Skip the first n input frames"
);
static
const
arg_def_t
deadline
=
ARG_DEF
(
"d"
,
"deadline"
,
1
,
"Deadline per frame (usec)"
);
static
const
arg_def_t
good_dl
=
ARG_DEF
(
NULL
,
"good"
,
0
,
"Use Good Quality Deadline"
);
static
const
arg_def_t
quietarg
=
ARG_DEF
(
"q"
,
"quiet"
,
0
,
"Do not print encode progress"
);
static
const
arg_def_t
verbosearg
=
...
...
@@ -216,8 +212,6 @@ static const arg_def_t *main_args[] = { &help,
&
fpf_name
,
&
limit
,
&
skip
,
&
deadline
,
&
good_dl
,
&
quietarg
,
&
verbosearg
,
&
psnrarg
,
...
...
@@ -902,8 +896,6 @@ static void parse_global_config(struct AvxEncoderConfig *global, char **argv) {
global
->
codec
=
get_aom_encoder_by_index
(
num_encoder
-
1
);
global
->
passes
=
0
;
global
->
color_type
=
I420
;
/* Assign default deadline to good quality */
global
->
deadline
=
AOM_DL_GOOD_QUALITY
;
for
(
argi
=
argj
=
argv
;
(
*
argj
=
*
argi
);
argi
+=
arg
.
argv_step
)
{
arg
.
argv_step
=
1
;
...
...
@@ -927,10 +919,6 @@ static void parse_global_config(struct AvxEncoderConfig *global, char **argv) {
die
(
"Error: Invalid pass selected (%d)
\n
"
,
global
->
pass
);
}
else
if
(
arg_match
(
&
arg
,
&
usage
,
argi
))
global
->
usage
=
arg_parse_uint
(
&
arg
);
else
if
(
arg_match
(
&
arg
,
&
deadline
,
argi
))
global
->
deadline
=
arg_parse_uint
(
&
arg
);
else
if
(
arg_match
(
&
arg
,
&
good_dl
,
argi
))
global
->
deadline
=
AOM_DL_GOOD_QUALITY
;
else
if
(
arg_match
(
&
arg
,
&
use_yv12
,
argi
))
global
->
color_type
=
YV12
;
else
if
(
arg_match
(
&
arg
,
&
use_i420
,
argi
))
...
...
@@ -1694,8 +1682,7 @@ static void encode_frame(struct stream_state *stream,
aom_usec_timer_start
(
&
timer
);
aom_codec_encode
(
&
stream
->
encoder
,
img
,
frame_start
,
(
unsigned
long
)(
next_frame_start
-
frame_start
),
0
,
global
->
deadline
);
(
uint32_t
)(
next_frame_start
-
frame_start
),
0
);
aom_usec_timer_mark
(
&
timer
);
stream
->
cx_time
+=
aom_usec_timer_elapsed
(
&
timer
);
ctx_exit_on_error
(
&
stream
->
encoder
,
"Stream %d: Failed to encode frame"
,
...
...
@@ -1769,7 +1756,7 @@ static void get_cx_data(struct stream_state *stream,
#if CONFIG_AV1_DECODER
if
(
global
->
test_decode
!=
TEST_DECODE_OFF
&&
!
stream
->
mismatch_seen
)
{
aom_codec_decode
(
&
stream
->
decoder
,
pkt
->
data
.
frame
.
buf
,
(
unsigned
int
)
pkt
->
data
.
frame
.
sz
,
NULL
,
0
);
(
unsigned
int
)
pkt
->
data
.
frame
.
sz
,
NULL
);
if
(
stream
->
decoder
.
err
)
{
warn_or_exit_on_error
(
&
stream
->
decoder
,
global
->
test_decode
==
TEST_DECODE_FATAL
,
...
...
aomenc.h
View file @
47cc2559
...
...
@@ -39,7 +39,6 @@ struct AvxEncoderConfig {
int
passes
;
int
pass
;
int
usage
;
int
deadline
;
ColorInputType
color_type
;
int
quiet
;
int
verbose
;
...
...
av1/av1_cx_iface.c
View file @
47cc2559
...
...
@@ -1110,26 +1110,6 @@ static aom_codec_err_t encoder_destroy(aom_codec_alg_priv_t *ctx) {
return
AOM_CODEC_OK
;
}
static
void
pick_quickcompress_mode
(
aom_codec_alg_priv_t
*
ctx
,
unsigned
long
deadline
)
{
MODE
new_mode
=
GOOD
;
switch
(
ctx
->
cfg
.
g_pass
)
{
case
AOM_RC_ONE_PASS
:
switch
(
deadline
)
{
default:
new_mode
=
GOOD
;
break
;
}
break
;
case
AOM_RC_FIRST_PASS
:
break
;
case
AOM_RC_LAST_PASS
:
new_mode
=
GOOD
;
}
if
(
ctx
->
oxcf
.
mode
!=
new_mode
)
{
ctx
->
oxcf
.
mode
=
new_mode
;
av1_change_config
(
ctx
->
cpi
,
&
ctx
->
oxcf
);
}
}
// Turn on to test if supplemental superframe data breaks decoding
#define TEST_SUPPLEMENTAL_SUPERFRAME_DATA 0
...
...
@@ -1233,8 +1213,7 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
const
aom_image_t
*
img
,
aom_codec_pts_t
pts
,
unsigned
long
duration
,
aom_enc_frame_flags_t
enc_flags
,
unsigned
long
deadline
)
{
aom_enc_frame_flags_t
enc_flags
)
{
const
size_t
kMinCompressedSize
=
8192
;
volatile
aom_codec_err_t
res
=
AOM_CODEC_OK
;
AV1_COMP
*
const
cpi
=
ctx
->
cpi
;
...
...
@@ -1261,7 +1240,11 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
}
}
pick_quickcompress_mode
(
ctx
,
deadline
);
if
(
ctx
->
oxcf
.
mode
!=
GOOD
)
{
ctx
->
oxcf
.
mode
=
GOOD
;
av1_change_config
(
ctx
->
cpi
,
&
ctx
->
oxcf
);
}
aom_codec_pkt_list_init
(
&
ctx
->
pkt_list
);
volatile
aom_enc_frame_flags_t
flags
=
enc_flags
;
...
...
av1/av1_dx_iface.c
View file @
47cc2559
...
...
@@ -594,9 +594,8 @@ static INLINE void check_resync(aom_codec_alg_priv_t *const ctx,
static
aom_codec_err_t
decode_one
(
aom_codec_alg_priv_t
*
ctx
,
const
uint8_t
**
data
,
unsigned
int
data_sz
,
void
*
user_priv
,
int64_t
deadline
)
{
void
*
user_priv
)
{
const
AVxWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
(
void
)
deadline
;
// Determine the stream parameters. Note that we rely on peek_si to
// validate that we have a buffer that does not wrap around the top
...
...
@@ -708,7 +707,7 @@ static void wait_worker_and_cache_frame(aom_codec_alg_priv_t *ctx) {
static
aom_codec_err_t
decoder_decode
(
aom_codec_alg_priv_t
*
ctx
,
const
uint8_t
*
data
,
unsigned
int
data_sz
,
void
*
user_priv
,
long
deadline
)
{
void
*
user_priv
)
{
const
uint8_t
*
data_start
=
data
;
const
uint8_t
*
const
data_end
=
data
+
data_sz
;
aom_codec_err_t
res
=
AOM_CODEC_OK
;
...
...
@@ -765,8 +764,7 @@ static aom_codec_err_t decoder_decode(aom_codec_alg_priv_t *ctx,
}
}
res
=
decode_one
(
ctx
,
&
data_start_copy
,
frame_size
,
user_priv
,
deadline
);
res
=
decode_one
(
ctx
,
&
data_start_copy
,
frame_size
,
user_priv
);
if
(
res
!=
AOM_CODEC_OK
)
return
res
;
data_start
+=
frame_size
;
}
...
...
@@ -783,7 +781,7 @@ static aom_codec_err_t decoder_decode(aom_codec_alg_priv_t *ctx,
}
}
res
=
decode_one
(
ctx
,
&
data
,
data_sz
,
user_priv
,
deadline
);
res
=
decode_one
(
ctx
,
&
data
,
data_sz
,
user_priv
);
if
(
res
!=
AOM_CODEC_OK
)
return
res
;
}
}
else
{
...
...
@@ -800,8 +798,7 @@ static aom_codec_err_t decoder_decode(aom_codec_alg_priv_t *ctx,
return
AOM_CODEC_CORRUPT_FRAME
;
}
res
=
decode_one
(
ctx
,
&
data_start_copy
,
frame_size
,
user_priv
,
deadline
);
res
=
decode_one
(
ctx
,
&
data_start_copy
,
frame_size
,
user_priv
);
if
(
res
!=
AOM_CODEC_OK
)
return
res
;
data_start
+=
frame_size
;
...
...
@@ -809,7 +806,7 @@ static aom_codec_err_t decoder_decode(aom_codec_alg_priv_t *ctx,
}
else
{
while
(
data_start
<
data_end
)
{
const
uint32_t
frame_size
=
(
uint32_t
)(
data_end
-
data_start
);
res
=
decode_one
(
ctx
,
&
data_start
,
frame_size
,
user_priv
,
deadline
);
res
=
decode_one
(
ctx
,
&
data_start
,
frame_size
,
user_priv
);
if
(
res
!=
AOM_CODEC_OK
)
return
res
;
// Account for suboptimal termination by the encoder.
...
...
examples/analyzer.cc
View file @
47cc2559
...
...
@@ -108,7 +108,7 @@ bool AV1Decoder::step() {
size_t
frame_size
;
const
unsigned
char
*
frame_data
;
frame_data
=
aom_video_reader_get_frame
(
reader
,
&
frame_size
);
if
(
aom_codec_decode
(
&
codec
,
frame_data
,
frame_size
,
NULL
,
0
))
{
if
(
aom_codec_decode
(
&
codec
,
frame_data
,
frame_size
,
NULL
))
{
fprintf
(
stderr
,
"Failed to decode frame."
);
return
false
;
}
else
{
...
...
examples/aom_cx_set_ref.c
View file @
47cc2559
...
...
@@ -111,8 +111,7 @@ static int encode_frame(aom_codec_ctx_t *ecodec, aom_image_t *img,
aom_codec_iter_t
iter
=
NULL
;
const
aom_codec_cx_pkt_t
*
pkt
=
NULL
;
int
got_data
;
const
aom_codec_err_t
res
=
aom_codec_encode
(
ecodec
,
img
,
frame_in
,
1
,
0
,
AOM_DL_GOOD_QUALITY
);
const
aom_codec_err_t
res
=
aom_codec_encode
(
ecodec
,
img
,
frame_in
,
1
,
0
);
if
(
res
!=
AOM_CODEC_OK
)
die_codec
(
ecodec
,
"Failed to encode frame"
);
got_data
=
0
;
...
...
@@ -139,7 +138,7 @@ static int encode_frame(aom_codec_ctx_t *ecodec, aom_image_t *img,
// Decode 1 frame.
if
(
test_decode
)
{
if
(
aom_codec_decode
(
dcodec
,
pkt
->
data
.
frame
.
buf
,
(
unsigned
int
)
pkt
->
data
.
frame
.
sz
,
NULL
,
0
))
(
unsigned
int
)
pkt
->
data
.
frame
.
sz
,
NULL
))
die_codec
(
dcodec
,
"Failed to decode frame."
);
}
}
...
...
examples/decode_to_md5.c
View file @
47cc2559
...
...
@@ -110,7 +110,7 @@ int main(int argc, char **argv) {
size_t
frame_size
=
0
;
const
unsigned
char
*
frame
=
aom_video_reader_get_frame
(
reader
,
&
frame_size
);
if
(
aom_codec_decode
(
&
codec
,
frame
,
(
unsigned
int
)
frame_size
,
NULL
,
0
))
if
(
aom_codec_decode
(
&
codec
,
frame
,
(
unsigned
int
)
frame_size
,
NULL
))
die_codec
(
&
codec
,
"Failed to decode frame"
);
while
((
img
=
aom_codec_get_frame
(
&
codec
,
&
iter
))
!=
NULL
)
{
...
...
examples/decode_with_drops.c
View file @
47cc2559
...
...
@@ -116,7 +116,7 @@ int main(int argc, char **argv) {
int
skip
;
const
unsigned
char
*
frame
=
aom_video_reader_get_frame
(
reader
,
&
frame_size
);
if
(
aom_codec_decode
(
&
codec
,
frame
,
(
unsigned
int
)
frame_size
,
NULL
,
0
))
if
(
aom_codec_decode
(
&
codec
,
frame
,
(
unsigned
int
)
frame_size
,
NULL
))
die_codec
(
&
codec
,
"Failed to decode frame."
);
++
frame_cnt
;
...
...
examples/inspect.c
View file @
47cc2559
...
...
@@ -663,7 +663,7 @@ int read_frame() {
aom_codec_iter_t
iter
=
NULL
;
size_t
frame_size
=
0
;
const
unsigned
char
*
frame
=
aom_video_reader_get_frame
(
reader
,
&
frame_size
);
if
(
aom_codec_decode
(
&
codec
,
frame
,
(
unsigned
int
)
frame_size
,
NULL
,
0
)
!=
if
(
aom_codec_decode
(
&
codec
,
frame
,
(
unsigned
int
)
frame_size
,
NULL
)
!=
AOM_CODEC_OK
)
{
die_codec
(
&
codec
,
"Failed to decode frame."
);
}
...
...
examples/lightfield_decoder.c
View file @
47cc2559
...
...
@@ -137,7 +137,7 @@ int main(int argc, char **argv) {
size_t
frame_size
=
0
;
const
unsigned
char
*
frame
=
aom_video_reader_get_frame
(
reader
,
&
frame_size
);
if
(
aom_codec_decode
(
&
codec
,
frame
,
(
unsigned
int
)
frame_size
,
NULL
,
0
))
if
(
aom_codec_decode
(
&
codec
,
frame
,
(
unsigned
int
)
frame_size
,
NULL
))
die_codec
(
&
codec
,
"Failed to decode frame."
);
while
((
img
=
aom_codec_get_frame
(
&
codec
,
&
iter
))
!=
NULL
)
{
...
...
@@ -176,7 +176,7 @@ int main(int argc, char **argv) {
aom_codec_control_
(
&
codec
,
AV1_SET_DECODE_TILE_ROW
,
tile_t
);
aom_codec_control_
(
&
codec
,
AV1_SET_DECODE_TILE_COL
,
tile_s
);
aom_codec_err_t
aom_status
=
aom_codec_decode
(
&
codec
,
frame
,
(
unsigned
int
)
frame_size
,
NULL
,
0
);
aom_codec_decode
(
&
codec
,
frame
,
(
unsigned
int
)
frame_size
,
NULL
);
if
(
aom_status
)
die_codec
(
&
codec
,
"Failed to decode tile."
);
aom_codec_iter_t
iter
=
NULL
;
aom_image_t
*
img
=
aom_codec_get_frame
(
&
codec
,
&
iter
);
...
...
examples/lightfield_encoder.c
View file @
47cc2559
...
...
@@ -43,7 +43,6 @@
#include "../video_writer.h"
static
const
char
*
exec_name
;
static
const
unsigned
int
deadline
=
AOM_DL_GOOD_QUALITY
;
void
usage_exit
(
void
)
{
fprintf
(
stderr
,
...
...
@@ -92,13 +91,12 @@ static int aom_img_size_bytes(aom_image_t *img) {
static
int
get_frame_stats
(
aom_codec_ctx_t
*
ctx
,
const
aom_image_t
*
img
,
aom_codec_pts_t
pts
,
unsigned
int
duration
,
aom_enc_frame_flags_t
flags
,
unsigned
int
dl
,
aom_enc_frame_flags_t
flags
,
aom_fixed_buf_t
*
stats
)
{
int
got_pkts
=
0
;
aom_codec_iter_t
iter
=
NULL
;
const
aom_codec_cx_pkt_t
*
pkt
=
NULL
;
const
aom_codec_err_t
res
=
aom_codec_encode
(
ctx
,
img
,
pts
,
duration
,
flags
,
dl
);
const
aom_codec_err_t
res
=
aom_codec_encode
(
ctx
,
img
,
pts
,
duration
,
flags
);
if
(
res
!=
AOM_CODEC_OK
)
die_codec
(
ctx
,
"Failed to get frame stats."
);
while
((
pkt
=
aom_codec_get_cx_data
(
ctx
,
&
iter
))
!=
NULL
)
{
...
...
@@ -118,13 +116,11 @@ static int get_frame_stats(aom_codec_ctx_t *ctx, const aom_image_t *img,
static
int
encode_frame
(
aom_codec_ctx_t
*
ctx
,
const
aom_image_t
*
img
,
aom_codec_pts_t
pts
,
unsigned
int
duration
,
aom_enc_frame_flags_t
flags
,
unsigned
int
dl
,
AvxVideoWriter
*
writer
)
{
aom_enc_frame_flags_t
flags
AvxVideoWriter
*
writer
)
{
int
got_pkts
=
0
;
aom_codec_iter_t
iter
=
NULL
;
const
aom_codec_cx_pkt_t
*
pkt
=
NULL
;
const
aom_codec_err_t
res
=
aom_codec_encode
(
ctx
,
img
,
pts
,
duration
,
flags
,
dl
);
const
aom_codec_err_t
res
=
aom_codec_encode
(
ctx
,
img
,
pts
,
duration
,
flags
);
if
(
res
!=
AOM_CODEC_OK
)
die_codec
(
ctx
,
"Failed to encode frame."
);
while
((
pkt
=
aom_codec_get_cx_data
(
ctx
,
&
iter
))
!=
NULL
)
{
...
...
@@ -197,7 +193,7 @@ static aom_fixed_buf_t pass0(aom_image_t *raw, FILE *infile,
AOM_EFLAG_NO_REF_BWD
|
AOM_EFLAG_NO_REF_ARF2
|
AOM_EFLAG_NO_UPD_LAST
|
AOM_EFLAG_NO_UPD_GF
|
AOM_EFLAG_NO_UPD_ARF
,
deadline
,
&
stats
);
&
stats
);
ref_frame
.
idx
=
0
;
aom_codec_control
(
&
codec
,
AV1_GET_REFERENCE
,
&
ref_frame
);
aom_img_copy
(
&
ref_frame
.
img
,
&
reference_images
[
frame_count
-
1
]);
...
...
@@ -234,14 +230,14 @@ static aom_fixed_buf_t pass0(aom_image_t *raw, FILE *infile,
AOM_EFLAG_NO_REF_BWD
|
AOM_EFLAG_NO_REF_ARF2
|
AOM_EFLAG_NO_UPD_LAST
|
AOM_EFLAG_NO_UPD_GF
|
AOM_EFLAG_NO_UPD_ARF
|
AOM_EFLAG_NO_UPD_ENTROPY
,
deadline
,
&
stats
);
&
stats
);
}
}
}
}
// Flush encoder.
// No ARF, this should not be needed.
while
(
get_frame_stats
(
&
codec
,
NULL
,
frame_count
,
1
,
0
,
deadline
,
&
stats
))
{
while
(
get_frame_stats
(
&
codec
,
NULL
,
frame_count
,
1
,
0
,
&
stats
))
{
}
printf
(
"Pass 0 complete. Processed %d frames.
\n
"
,
frame_count
);
...
...
@@ -310,7 +306,7 @@ static void pass1(aom_image_t *raw, FILE *infile, const char *outfile_name,
AOM_EFLAG_NO_REF_BWD
|
AOM_EFLAG_NO_REF_ARF2
|
AOM_EFLAG_NO_UPD_LAST
|
AOM_EFLAG_NO_UPD_GF
|
AOM_EFLAG_NO_UPD_ARF
|
AOM_EFLAG_NO_UPD_ENTROPY
,
deadline
,
writer
);
writer
);
ref_frame
.
idx
=
0
;
aom_codec_control
(
&
codec
,
AV1_GET_REFERENCE
,
&
ref_frame
);
aom_img_copy
(
&
ref_frame
.
img
,
&
reference_images
[
frame_count
-
1
]);
...
...
@@ -366,7 +362,7 @@ static void pass1(aom_image_t *raw, FILE *infile, const char *outfile_name,
AOM_EFLAG_NO_REF_BWD
|
AOM_EFLAG_NO_REF_ARF2
|
AOM_EFLAG_NO_UPD_LAST
|
AOM_EFLAG_NO_UPD_GF
|
AOM_EFLAG_NO_UPD_ARF
|
AOM_EFLAG_NO_UPD_ENTROPY
,
deadline
,
writer
);
writer
);
}
}
}
...
...
@@ -374,7 +370,7 @@ static void pass1(aom_image_t *raw, FILE *infile, const char *outfile_name,
// Flush encoder.
// No ARF, this should not be needed.
while
(
encode_frame
(
&
codec
,
NULL
,
-
1
,
1
,
0
,
deadline
,
writer
))
{
while
(
encode_frame
(
&
codec
,
NULL
,
-
1
,
1
,
0
,
writer
))
{
}
if
(
aom_codec_destroy
(
&
codec
))
die_codec
(
&
codec
,
"Failed to destroy codec."
);
...
...
examples/lossless_encoder.c
View file @
47cc2559
...
...
@@ -35,7 +35,7 @@ static int encode_frame(aom_codec_ctx_t *codec, aom_image_t *img,
aom_codec_iter_t
iter
=
NULL
;
const
aom_codec_cx_pkt_t
*
pkt
=
NULL
;
const
aom_codec_err_t
res
=
aom_codec_encode
(
codec
,
img
,
frame_index
,
1
,
flags
,
AOM_DL_GOOD_QUALITY
);
aom_codec_encode
(
codec
,
img
,
frame_index
,
1
,
flags
);
if
(
res
!=
AOM_CODEC_OK
)
die_codec
(
codec
,
"Failed to encode frame"
);
while
((
pkt
=
aom_codec_get_cx_data
(
codec
,
&
iter
))
!=
NULL
)
{
...
...
examples/set_maps.c
View file @
47cc2559
...
...
@@ -95,8 +95,7 @@ static int encode_frame(aom_codec_ctx_t *codec, aom_image_t *img,
int
got_pkts
=
0
;
aom_codec_iter_t
iter
=
NULL
;
const
aom_codec_cx_pkt_t
*
pkt
=
NULL
;
const
aom_codec_err_t
res
=
aom_codec_encode
(
codec
,
img
,
frame_index
,
1
,
0
,
AOM_DL_GOOD_QUALITY
);
const
aom_codec_err_t
res
=
aom_codec_encode
(
codec
,
img
,
frame_index
,
1
,
0
);
if
(
res
!=
AOM_CODEC_OK
)
die_codec
(
codec
,
"Failed to encode frame"
);
while
((
pkt
=
aom_codec_get_cx_data
(
codec
,
&
iter
))
!=
NULL
)
{
...
...
examples/simple_decoder.c
View file @
47cc2559
...
...
@@ -49,9 +49,7 @@
// `aom_codec_decode` function. The call takes a pointer to the data
// (`frame`) and the length of the data (`frame_size`). No application data
// is associated with the frame in this example, so the `user_priv`
// parameter is NULL. The `deadline` parameter is left at zero for this
// example. This parameter is generally only used when doing adaptive post
// processing.
// parameter is NULL.
//
// Codecs may produce a variable number of output frames for every call to
// `aom_codec_decode`. These frames are retrieved by the
...
...
@@ -127,7 +125,7 @@ int main(int argc, char **argv) {
size_t
frame_size
=
0
;
const
unsigned
char
*
frame
=
aom_video_reader_get_frame
(
reader
,
&
frame_size
);
if
(
aom_codec_decode
(
&
codec
,
frame
,
(
unsigned
int
)
frame_size
,
NULL
,
0
))
if
(
aom_codec_decode
(
&
codec
,
frame
,
(
unsigned
int
)
frame_size
,
NULL
))
die_codec
(
&
codec
,
"Failed to decode frame."
);
while
((
img
=
aom_codec_get_frame
(
&
codec
,
&
iter
))
!=
NULL
)
{
...
...
Prev
1
2
Next
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