2010-05-18 17:58:33 +02:00
|
|
|
/*
|
2010-09-09 14:16:39 +02:00
|
|
|
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
2010-05-18 17:58:33 +02:00
|
|
|
*
|
2010-06-18 18:39:21 +02:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
2010-06-04 22:19:40 +02:00
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
2010-06-18 18:39:21 +02:00
|
|
|
* in the file PATENTS. All contributing project authors may
|
2010-06-04 22:19:40 +02:00
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2010-05-18 17:58:33 +02:00
|
|
|
*/
|
|
|
|
|
2014-03-06 21:08:20 +01:00
|
|
|
#ifndef VP9_DECODER_VP9_DECODER_H_
|
|
|
|
#define VP9_DECODER_VP9_DECODER_H_
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2014-03-03 23:34:39 +01:00
|
|
|
#include "./vpx_config.h"
|
|
|
|
|
|
|
|
#include "vpx/vpx_codec.h"
|
2010-05-18 17:58:33 +02:00
|
|
|
#include "vpx_scale/yv12config.h"
|
2014-03-03 23:34:39 +01:00
|
|
|
|
|
|
|
#include "vp9/common/vp9_onyxc_int.h"
|
2012-11-28 19:41:40 +01:00
|
|
|
#include "vp9/common/vp9_ppflags.h"
|
2014-07-07 23:52:19 +02:00
|
|
|
#include "vp9/common/vp9_thread.h"
|
2014-03-03 23:34:39 +01:00
|
|
|
|
|
|
|
#include "vp9/decoder/vp9_dthread.h"
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2014-01-18 21:16:11 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-05-15 19:51:55 +02:00
|
|
|
// TODO(hkuang): combine this with TileWorkerData.
|
|
|
|
typedef struct TileData {
|
|
|
|
VP9_COMMON *cm;
|
|
|
|
vp9_reader bit_reader;
|
|
|
|
DECLARE_ALIGNED(16, MACROBLOCKD, xd);
|
|
|
|
} TileData;
|
|
|
|
|
2014-04-08 20:41:12 +02:00
|
|
|
typedef struct VP9Decoder {
|
2014-03-03 23:34:39 +01:00
|
|
|
DECLARE_ALIGNED(16, MACROBLOCKD, mb);
|
|
|
|
|
|
|
|
DECLARE_ALIGNED(16, VP9_COMMON, common);
|
|
|
|
|
|
|
|
int ready_for_new_data;
|
|
|
|
|
|
|
|
int refresh_frame_flags;
|
|
|
|
|
2014-06-12 01:06:50 +02:00
|
|
|
int frame_parallel_decode; // frame-based threading.
|
|
|
|
|
2014-03-03 23:34:39 +01:00
|
|
|
VP9Worker lf_worker;
|
|
|
|
VP9Worker *tile_workers;
|
|
|
|
int num_tile_workers;
|
|
|
|
|
2014-05-15 19:51:55 +02:00
|
|
|
TileData *tile_data;
|
|
|
|
int total_tiles;
|
|
|
|
|
2014-03-03 23:34:39 +01:00
|
|
|
VP9LfSync lf_row_sync;
|
2014-04-15 23:10:58 +02:00
|
|
|
|
|
|
|
vpx_decrypt_cb decrypt_cb;
|
|
|
|
void *decrypt_state;
|
2014-05-09 01:24:36 +02:00
|
|
|
|
|
|
|
int max_threads;
|
|
|
|
int inv_tile_order;
|
2014-09-10 03:55:20 +02:00
|
|
|
int need_resync; // wait for key/intra-only frame
|
2014-04-08 20:41:12 +02:00
|
|
|
} VP9Decoder;
|
2014-03-03 23:34:39 +01:00
|
|
|
|
2014-04-08 20:41:12 +02:00
|
|
|
int vp9_receive_compressed_data(struct VP9Decoder *pbi,
|
2014-05-14 02:35:46 +02:00
|
|
|
size_t size, const uint8_t **dest);
|
2013-04-02 22:34:20 +02:00
|
|
|
|
2014-05-14 02:35:46 +02:00
|
|
|
int vp9_get_raw_frame(struct VP9Decoder *pbi, YV12_BUFFER_CONFIG *sd,
|
2013-04-02 22:34:20 +02:00
|
|
|
vp9_ppflags_t *flags);
|
|
|
|
|
2014-04-08 20:41:12 +02:00
|
|
|
vpx_codec_err_t vp9_copy_reference_dec(struct VP9Decoder *pbi,
|
2013-04-02 22:34:20 +02:00
|
|
|
VP9_REFFRAME ref_frame_flag,
|
|
|
|
YV12_BUFFER_CONFIG *sd);
|
|
|
|
|
2014-03-21 22:20:13 +01:00
|
|
|
vpx_codec_err_t vp9_set_reference_dec(VP9_COMMON *cm,
|
2013-04-02 22:34:20 +02:00
|
|
|
VP9_REFFRAME ref_frame_flag,
|
|
|
|
YV12_BUFFER_CONFIG *sd);
|
|
|
|
|
2014-05-09 01:24:36 +02:00
|
|
|
struct VP9Decoder *vp9_decoder_create();
|
2013-04-02 22:34:20 +02:00
|
|
|
|
2014-04-08 20:41:12 +02:00
|
|
|
void vp9_decoder_remove(struct VP9Decoder *pbi);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2014-08-13 22:12:00 +02:00
|
|
|
static INLINE uint8_t read_marker(vpx_decrypt_cb decrypt_cb,
|
|
|
|
void *decrypt_state,
|
|
|
|
const uint8_t *data) {
|
|
|
|
if (decrypt_cb) {
|
|
|
|
uint8_t marker;
|
|
|
|
decrypt_cb(decrypt_state, data, &marker, 1);
|
|
|
|
return marker;
|
|
|
|
}
|
|
|
|
return *data;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This function is exposed for use in tests, as well as the inlined function
|
|
|
|
// "read_marker".
|
|
|
|
vpx_codec_err_t vp9_parse_superframe_index(const uint8_t *data,
|
|
|
|
size_t data_sz,
|
|
|
|
uint32_t sizes[8], int *count,
|
|
|
|
vpx_decrypt_cb decrypt_cb,
|
|
|
|
void *decrypt_state);
|
|
|
|
|
2010-05-18 17:58:33 +02:00
|
|
|
#ifdef __cplusplus
|
2014-01-18 21:16:11 +01:00
|
|
|
} // extern "C"
|
2010-05-18 17:58:33 +02:00
|
|
|
#endif
|
|
|
|
|
2014-03-06 21:08:20 +01:00
|
|
|
#endif // VP9_DECODER_VP9_DECODER_H_
|