summaryrefslogtreecommitdiff
path: root/third_party/aom/av1/av1_dx_iface.c
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/aom/av1/av1_dx_iface.c')
-rw-r--r--third_party/aom/av1/av1_dx_iface.c50
1 files changed, 47 insertions, 3 deletions
diff --git a/third_party/aom/av1/av1_dx_iface.c b/third_party/aom/av1/av1_dx_iface.c
index 8f069093b..c95a8f24e 100644
--- a/third_party/aom/av1/av1_dx_iface.c
+++ b/third_party/aom/av1/av1_dx_iface.c
@@ -106,6 +106,8 @@ static aom_codec_err_t decoder_init(aom_codec_ctx_t *ctx,
(ctx->init_flags & AOM_CODEC_USE_FRAME_THREADING))
? 1
: 0;
+ // TODO(tdaede): this should not be exposed to the API
+ priv->cfg.allow_lowbitdepth = CONFIG_LOWBITDEPTH;
if (ctx->config.dec) {
priv->cfg = *ctx->config.dec;
ctx->config.dec = &priv->cfg;
@@ -154,14 +156,40 @@ static aom_codec_err_t decoder_destroy(aom_codec_alg_priv_t *ctx) {
static int parse_bitdepth_colorspace_sampling(BITSTREAM_PROFILE profile,
struct aom_read_bit_buffer *rb) {
aom_color_space_t color_space;
+#if CONFIG_COLORSPACE_HEADERS
+ int subsampling_x = 0;
+ int subsampling_y = 0;
+#endif
+
if (profile >= PROFILE_2) rb->bit_offset += 1; // Bit-depth 10 or 12.
+#if CONFIG_COLORSPACE_HEADERS
+ color_space = (aom_color_space_t)aom_rb_read_literal(rb, 5);
+ rb->bit_offset += 5; // Transfer function
+#else
color_space = (aom_color_space_t)aom_rb_read_literal(rb, 3);
+#endif
if (color_space != AOM_CS_SRGB) {
rb->bit_offset += 1; // [16,235] (including xvycc) vs [0,255] range.
+
if (profile == PROFILE_1 || profile == PROFILE_3) {
+#if CONFIG_COLORSPACE_HEADERS
+ subsampling_x = aom_rb_read_bit(rb);
+ subsampling_y = aom_rb_read_bit(rb);
+#else
rb->bit_offset += 2; // subsampling x/y.
+#endif
rb->bit_offset += 1; // unused.
+#if CONFIG_COLORSPACE_HEADERS
+ } else {
+ subsampling_x = 1;
+ subsampling_y = 1;
+ }
+ if (subsampling_x == 1 && subsampling_y == 1) {
+ rb->bit_offset += 2;
+ }
+#else
}
+#endif
} else {
if (profile == PROFILE_1 || profile == PROFILE_3) {
rb->bit_offset += 1; // unused
@@ -196,6 +224,9 @@ static aom_codec_err_t decoder_peek_si_internal(
struct aom_read_bit_buffer rb = { data, data + data_sz, 0, NULL, NULL };
const int frame_marker = aom_rb_read_literal(&rb, 2);
const BITSTREAM_PROFILE profile = av1_read_profile(&rb);
+#if CONFIG_EXT_TILE
+ unsigned int large_scale_tile;
+#endif // CONFIG_EXT_TILE
if (frame_marker != AOM_FRAME_MARKER) return AOM_CODEC_UNSUP_BITSTREAM;
@@ -204,6 +235,10 @@ static aom_codec_err_t decoder_peek_si_internal(
if ((profile >= 2 && data_sz <= 1) || data_sz < 1)
return AOM_CODEC_UNSUP_BITSTREAM;
+#if CONFIG_EXT_TILE
+ large_scale_tile = aom_rb_read_literal(&rb, 1);
+#endif // CONFIG_EXT_TILE
+
if (aom_rb_read_bit(&rb)) { // show an existing frame
aom_rb_read_literal(&rb, 3); // Frame buffer to show.
return AOM_CODEC_OK;
@@ -220,6 +255,9 @@ static aom_codec_err_t decoder_peek_si_internal(
int frame_id_len;
SequenceHeader seq_params;
read_sequence_header(&seq_params);
+#if CONFIG_EXT_TILE
+ if (large_scale_tile) seq_params.frame_id_numbers_present_flag = 0;
+#endif // CONFIG_EXT_TILE
if (seq_params.frame_id_numbers_present_flag) {
frame_id_len = seq_params.frame_id_length_minus7 + 7;
aom_rb_read_literal(&rb, frame_id_len);
@@ -417,6 +455,8 @@ static aom_codec_err_t init_decoder(aom_codec_alg_priv_t *ctx) {
return AOM_CODEC_MEM_ERROR;
}
#endif
+ frame_worker_data->pbi->allow_lowbitdepth = ctx->cfg.allow_lowbitdepth;
+
// If decoding in serial mode, FrameWorker thread could create tile worker
// thread or loopfilter thread.
frame_worker_data->pbi->max_threads =
@@ -597,10 +637,14 @@ static aom_codec_err_t decoder_decode(aom_codec_alg_priv_t *ctx,
if (res != AOM_CODEC_OK) return res;
}
+ int index_size = 0;
res = av1_parse_superframe_index(data, data_sz, frame_sizes, &frame_count,
- ctx->decrypt_cb, ctx->decrypt_state);
+ &index_size, ctx->decrypt_cb,
+ ctx->decrypt_state);
if (res != AOM_CODEC_OK) return res;
+ data_start += index_size;
+
if (ctx->frame_parallel_decode) {
// Decode in frame parallel mode. When decoding in this mode, the frame
// passed to the decoder must be either a normal frame or a superframe with
@@ -752,7 +796,7 @@ static aom_image_t *decoder_get_frame(aom_codec_alg_priv_t *ctx,
yuvconfig2image(&ctx->img, &sd, frame_worker_data->user_priv);
#if CONFIG_EXT_TILE
- if (cm->tile_encoding_mode &&
+ if (cm->single_tile_decoding &&
frame_worker_data->pbi->dec_tile_row >= 0) {
const int tile_row =
AOMMIN(frame_worker_data->pbi->dec_tile_row, cm->tile_rows - 1);
@@ -768,7 +812,7 @@ static aom_image_t *decoder_get_frame(aom_codec_alg_priv_t *ctx,
AOMMIN(cm->tile_height, cm->mi_rows - mi_row) * MI_SIZE;
}
- if (cm->tile_encoding_mode &&
+ if (cm->single_tile_decoding &&
frame_worker_data->pbi->dec_tile_col >= 0) {
const int tile_col =
AOMMIN(frame_worker_data->pbi->dec_tile_col, cm->tile_cols - 1);