Commit 47cc2559 authored by Sean DuBois's avatar Sean DuBois

Remove deadline

BUG=aomedia:13

Change-Id: I9df343f4a6a809b09446ff1f2083c38771ab068b
parent 913867b4
......@@ -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
*
......
......@@ -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
*
......
......@@ -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);
......
......@@ -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);
......
......@@ -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--;
......
......@@ -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));
}
}
......
......@@ -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,
......
......@@ -39,7 +39,6 @@ struct AvxEncoderConfig {
int passes;
int pass;
int usage;
int deadline;
ColorInputType color_type;
int quiet;
int verbose;
......
......@@ -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;
......
......@@ -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.
......
......@@ -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 {
......
......@@ -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.");
}
}
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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.");
}
......
......@@ -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);
......
......@@ -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.");
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -121,7 +121,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) {
......
......@@ -68,13 +68,12 @@ void usage_exit(void) {
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 deadline,
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, deadline);
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) {
......@@ -94,13 +93,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 deadline,
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, deadline);
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) {
......@@ -133,13 +130,11 @@ static aom_fixed_buf_t pass0(aom_image_t *raw, FILE *infile,
// Calculate frame statistics.
while (aom_img_read(raw, infile) && frame_count < limit) {
++frame_count;
get_frame_stats(&codec, raw, frame_count, 1, 0, AOM_DL_GOOD_QUALITY,
&stats);
get_frame_stats(&codec, raw, frame_count, 1, 0, &stats);
}
// Flush encoder.
while (get_frame_stats(&codec, NULL, frame_count, 1, 0, AOM_DL_GOOD_QUALITY,
&stats)) {
while (get_frame_stats(&codec, NULL, frame_count, 1, 0, &stats)) {
}
printf("Pass 0 complete. Processed %d frames.\n", frame_count);
......@@ -168,11 +163,11 @@ static void pass1(aom_image_t *raw, FILE *infile, const char *outfile_name,
// Encode frames.
while (aom_img_read(raw, infile) && frame_count < limit) {
++frame_count;
encode_frame(&codec, raw, frame_count, 1, 0, AOM_DL_GOOD_QUALITY, writer);
encode_frame(&codec, raw, frame_count, 1, 0, writer);
}
// Flush encoder.
while (encode_frame(&codec, NULL, -1, 1, 0, AOM_DL_GOOD_QUALITY, writer)) {
while (encode_frame(&codec, NULL, -1, 1, 0, writer)) {
}
printf("\n");
......
......@@ -39,7 +39,6 @@ class CodecFactory {
const aom_codec_flags_t flags) const = 0;
virtual Encoder *CreateEncoder(aom_codec_enc_cfg_t cfg,
unsigned long deadline,
const unsigned long init_flags,
TwopassStatsStore *stats) const = 0;
......@@ -89,9 +88,9 @@ class AV1Decoder : public Decoder {
class AV1Encoder : public Encoder {
public:
AV1Encoder(aom_codec_enc_cfg_t cfg, unsigned long deadline,
const unsigned long init_flags, TwopassStatsStore *stats)
: Encoder(cfg, deadline, init_flags, stats) {}
AV1Encoder(aom_codec_enc_cfg_t cfg, const uint32_t init_flags,
TwopassStatsStore *stats)
: Encoder(cfg, init_flags, stats) {}
protected:
virtual aom_codec_iface_t *CodecInterface() const {
......@@ -123,14 +122,12 @@ class AV1CodecFactory : public CodecFactory {
}
virtual Encoder *CreateEncoder(aom_codec_enc_cfg_t cfg,
unsigned long deadline,
const unsigned long init_flags,
TwopassStatsStore *stats) const {
#if CONFIG_AV1_ENCODER
return new AV1Encoder(cfg, deadline, init_flags, stats);
return new AV1Encoder(cfg, init_flags, stats);
#else
(void)cfg;
(void)deadline;
(void)init_flags;
(void)stats;
return NULL;
......
......@@ -89,7 +89,7 @@ class CompressedSource {
aom_image_t img;
aom_img_wrap(&img, format_, width_, height_, 0, buf);
aom_codec_encode(&enc_, &img, frame_count_++, 1, 0, 0);
aom_codec_encode(&enc_, &img, frame_count_++, 1, 0);
aom_codec_iter_t iter = NULL;
......@@ -150,7 +150,7 @@ class Decoder {
std::vector<int16_t> decode(const aom_codec_cx_pkt_t *pkt) {
aom_codec_decode(&dec_, static_cast<uint8_t *>(pkt->data.frame.buf),
static_cast<unsigned int>(pkt->data.frame.sz), NULL, 0);
static_cast<unsigned int>(pkt->data.frame.sz), NULL);
aom_codec_iter_t iter = NULL;
return Serialize(aom_codec_get_frame(&dec_, &iter));
......
......@@ -30,12 +30,12 @@ TEST(DecodeAPI, InvalidParams) {
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_dec_init(NULL, NULL, NULL, 0));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_dec_init(&dec, NULL, NULL, 0));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_decode(NULL, NULL, 0, NULL, 0));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_decode(NULL, buf, 0, NULL, 0));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_decode(NULL, NULL, 0, NULL));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_decode(NULL, buf, 0, NULL));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM,
aom_codec_decode(NULL, buf, NELEMENTS(buf), NULL, 0));
aom_codec_decode(NULL, buf, NELEMENTS(buf), NULL));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM,
aom_codec_decode(NULL, NULL, NELEMENTS(buf), NULL, 0));
aom_codec_decode(NULL, NULL, NELEMENTS(buf), NULL));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_destroy(NULL));
EXPECT_TRUE(aom_codec_error(NULL) != NULL);
......@@ -47,11 +47,11 @@ TEST(DecodeAPI, InvalidParams) {
#if !CONFIG_OBU
// Needs to be fixed
EXPECT_EQ(AOM_CODEC_UNSUP_BITSTREAM,
aom_codec_decode(&dec, buf, NELEMENTS(buf), NULL, 0));
aom_codec_decode(&dec, buf, NELEMENTS(buf), NULL));
#endif
EXPECT_EQ(AOM_CODEC_INVALID_PARAM,
aom_codec_decode(&dec, NULL, NELEMENTS(buf), NULL, 0));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_decode(&dec, buf, 0, NULL, 0));
aom_codec_decode(&dec, NULL, NELEMENTS(buf), NULL));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_decode(&dec, buf, 0, NULL));
EXPECT_EQ(AOM_CODEC_OK, aom_codec_destroy(&dec));
}
......
......@@ -36,8 +36,8 @@ aom_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, size_t size,
aom_codec_err_t res_dec;
InitOnce();
API_REGISTER_STATE_CHECK(
res_dec = aom_codec_decode(
&decoder_, cxdata, static_cast<unsigned int>(size), user_priv, 0));
res_dec = aom_codec_decode(&decoder_, cxdata,
static_cast<unsigned int>(size), user_priv));
return res_dec;
}
......
......@@ -33,8 +33,8 @@ TEST(EncodeAPI, InvalidParams) {
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_enc_init(NULL, NULL, NULL, 0));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_enc_init(&enc, NULL, NULL, 0));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_encode(NULL, NULL, 0, 0, 0, 0));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_encode(NULL, &img, 0, 0, 0, 0));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_encode(NULL, NULL, 0, 0, 0));
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_encode(NULL, &img, 0, 0, 0));