Commit e7135a93 authored by Dmitry Kovalev's avatar Dmitry Kovalev

Removing decoded_key_frame flag.

Change-Id: I79576920efb7f3f6f197d386727409759d8bda8d
parent 0958bbd1
......@@ -1317,16 +1317,15 @@ static struct vp9_read_bit_buffer* init_read_bit_buffer(
return rb;
}
int vp9_decode_frame(VP9Decoder *pbi,
const uint8_t *data, const uint8_t *data_end,
const uint8_t **p_data_end) {
void vp9_decode_frame(VP9Decoder *pbi,
const uint8_t *data, const uint8_t *data_end,
const uint8_t **p_data_end) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
struct vp9_read_bit_buffer rb = { 0 };
uint8_t clear_data[MAX_VP9_HEADER_SIZE];
const size_t first_partition_size = read_uncompressed_header(pbi,
init_read_bit_buffer(pbi, &rb, data, data_end, clear_data));
const int keyframe = cm->frame_type == KEY_FRAME;
const int tile_rows = 1 << cm->log2_tile_rows;
const int tile_cols = 1 << cm->log2_tile_cols;
YV12_BUFFER_CONFIG *const new_fb = get_frame_new_buffer(cm);
......@@ -1335,12 +1334,9 @@ int vp9_decode_frame(VP9Decoder *pbi,
if (!first_partition_size) {
// showing a frame directly
*p_data_end = data + 1;
return 0;
return;
}
if (!pbi->decoded_key_frame && !keyframe)
return -1;
data += vp9_rb_bytes_read(&rb);
if (!read_is_valid(data, first_partition_size, data_end))
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
......@@ -1377,14 +1373,6 @@ int vp9_decode_frame(VP9Decoder *pbi,
new_fb->corrupted |= xd->corrupted;
if (!pbi->decoded_key_frame) {
if (keyframe && !new_fb->corrupted)
pbi->decoded_key_frame = 1;
else
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
"A stream must start with a complete key frame");
}
if (!new_fb->corrupted) {
if (!cm->error_resilient_mode && !cm->frame_parallel_decoding_mode) {
vp9_adapt_coef_probs(cm);
......@@ -1400,6 +1388,4 @@ int vp9_decode_frame(VP9Decoder *pbi,
if (cm->refresh_frame_context)
cm->frame_contexts[cm->frame_context_idx] = cm->fc;
return 0;
}
......@@ -21,9 +21,9 @@ struct VP9Decoder;
void vp9_init_dequantizer(struct VP9Common *cm);
int vp9_decode_frame(struct VP9Decoder *pbi,
const uint8_t *data, const uint8_t *data_end,
const uint8_t **p_data_end);
void vp9_decode_frame(struct VP9Decoder *pbi,
const uint8_t *data, const uint8_t *data_end,
const uint8_t **p_data_end);
#ifdef __cplusplus
} // extern "C"
......
......@@ -67,7 +67,6 @@ VP9Decoder *vp9_decoder_create() {
cm->current_video_frame = 0;
pbi->ready_for_new_data = 1;
pbi->decoded_key_frame = 0;
// vp9_init_dequantizer() is first called here. Add check in
// frame_init_dequantizer() to avoid unnecessary calling of
......@@ -267,15 +266,7 @@ int vp9_receive_compressed_data(VP9Decoder *pbi,
cm->error.setjmp = 1;
retcode = vp9_decode_frame(pbi, source, source + size, psource);
if (retcode < 0) {
cm->error.error_code = VPX_CODEC_ERROR;
cm->error.setjmp = 0;
if (cm->frame_bufs[cm->new_fb_idx].ref_count > 0)
cm->frame_bufs[cm->new_fb_idx].ref_count--;
return retcode;
}
vp9_decode_frame(pbi, source, source + size, psource);
swap_frame_buffers(pbi);
......
......@@ -43,8 +43,6 @@ typedef struct VP9Decoder {
int refresh_frame_flags;
int decoded_key_frame;
VP9Worker lf_worker;
VP9Worker *tile_workers;
int num_tile_workers;
......
......@@ -260,6 +260,9 @@ static vpx_codec_err_t decode_one(vpx_codec_alg_priv_t *ctx,
ctx->decrypt_state);
if (res != VPX_CODEC_OK)
return res;
if (!ctx->si.is_kf)
return VPX_CODEC_ERROR;
}
// Initialize the decoder instance on the first frame
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment