/* * Copyright (c) 2016, Alliance for Open Media. All rights reserved. * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/ #include <assert.h> #include <stdlib.h>
/* Return the buffer at the given absolute index and increment the index */ staticstruct lookahead_entry *pop(struct lookahead_ctx *ctx, int *idx) { int index = *idx; struct lookahead_entry *buf = ctx->buf + index;
assert(index < ctx->max_sz); if (++index >= ctx->max_sz) index -= ctx->max_sz;
*idx = index; return buf;
}
void av1_lookahead_destroy(struct lookahead_ctx *ctx) { if (ctx) { if (ctx->buf) { int i;
for (i = 0; i < ctx->max_sz; i++) aom_free_frame_buffer(&ctx->buf[i].img);
free(ctx->buf);
}
free(ctx);
}
}
struct lookahead_ctx *av1_lookahead_init( unsignedint width, unsignedint height, unsignedint subsampling_x, unsignedint subsampling_y, int use_highbitdepth, unsignedint depth, constint border_in_pixels, int byte_alignment, int num_lap_buffers, bool is_all_intra, bool alloc_pyramid) { int lag_in_frames = AOMMAX(1, depth);
// For all-intra frame encoding, previous source frames are not required. // Hence max_pre_frames is set to 0 in this case. As previous source frames // are accessed using a negative index to av1_lookahead_peek(), setting // max_pre_frames to 0 will cause av1_lookahead_peek() to return NULL for a // negative index. const uint8_t max_pre_frames = is_all_intra ? 0 : MAX_PRE_FRAMES;
// Add the lags to depth and clamp
depth += num_lap_buffers;
depth = clamp(depth, 1, MAX_TOTAL_BUFFERS);
int av1_lookahead_full(conststruct lookahead_ctx *ctx) { // TODO(angiebird): Test this function. return ctx->read_ctxs[ENCODE_STAGE].sz >= ctx->read_ctxs[ENCODE_STAGE].pop_sz;
}
int av1_lookahead_push(struct lookahead_ctx *ctx, const YV12_BUFFER_CONFIG *src,
int64_t ts_start, int64_t ts_end, int use_highbitdepth, bool alloc_pyramid, aom_enc_frame_flags_t flags) { int width = src->y_crop_width; int height = src->y_crop_height; int uv_width = src->uv_crop_width; int uv_height = src->uv_crop_height; int subsampling_x = src->subsampling_x; int subsampling_y = src->subsampling_y; int larger_dimensions, new_dimensions;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.