[spatial svc]Add a few different encode frame tests.
[platform/upstream/libvpx.git] / vp9 / decoder / vp9_decoder.h
1 /*
2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10
11 #ifndef VP9_DECODER_VP9_DECODER_H_
12 #define VP9_DECODER_VP9_DECODER_H_
13
14 #include "./vpx_config.h"
15
16 #include "vpx/vpx_codec.h"
17 #include "vpx_scale/yv12config.h"
18
19 #include "vp9/common/vp9_onyxc_int.h"
20 #include "vp9/common/vp9_ppflags.h"
21 #include "vp9/common/vp9_thread.h"
22
23 #include "vp9/decoder/vp9_dthread.h"
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 // TODO(hkuang): combine this with TileWorkerData.
30 typedef struct TileData {
31   VP9_COMMON *cm;
32   vp9_reader bit_reader;
33   DECLARE_ALIGNED(16, MACROBLOCKD, xd);
34 } TileData;
35
36 typedef struct VP9Decoder {
37   DECLARE_ALIGNED(16, MACROBLOCKD, mb);
38
39   DECLARE_ALIGNED(16, VP9_COMMON, common);
40
41   int ready_for_new_data;
42
43   int refresh_frame_flags;
44
45   int frame_parallel_decode;  // frame-based threading.
46
47   VP9Worker lf_worker;
48   VP9Worker *tile_workers;
49   int num_tile_workers;
50
51   TileData *tile_data;
52   int total_tiles;
53
54   VP9LfSync lf_row_sync;
55
56   vpx_decrypt_cb decrypt_cb;
57   void *decrypt_state;
58
59   int max_threads;
60   int inv_tile_order;
61 } VP9Decoder;
62
63 int vp9_receive_compressed_data(struct VP9Decoder *pbi,
64                                 size_t size, const uint8_t **dest);
65
66 int vp9_get_raw_frame(struct VP9Decoder *pbi, YV12_BUFFER_CONFIG *sd,
67                       vp9_ppflags_t *flags);
68
69 vpx_codec_err_t vp9_copy_reference_dec(struct VP9Decoder *pbi,
70                                        VP9_REFFRAME ref_frame_flag,
71                                        YV12_BUFFER_CONFIG *sd);
72
73 vpx_codec_err_t vp9_set_reference_dec(VP9_COMMON *cm,
74                                       VP9_REFFRAME ref_frame_flag,
75                                       YV12_BUFFER_CONFIG *sd);
76
77 struct VP9Decoder *vp9_decoder_create();
78
79 void vp9_decoder_remove(struct VP9Decoder *pbi);
80
81 static INLINE uint8_t read_marker(vpx_decrypt_cb decrypt_cb,
82                                   void *decrypt_state,
83                                   const uint8_t *data) {
84   if (decrypt_cb) {
85     uint8_t marker;
86     decrypt_cb(decrypt_state, data, &marker, 1);
87     return marker;
88   }
89   return *data;
90 }
91
92 // This function is exposed for use in tests, as well as the inlined function
93 // "read_marker".
94 vpx_codec_err_t vp9_parse_superframe_index(const uint8_t *data,
95                                            size_t data_sz,
96                                            uint32_t sizes[8], int *count,
97                                            vpx_decrypt_cb decrypt_cb,
98                                            void *decrypt_state);
99
100 #ifdef __cplusplus
101 }  // extern "C"
102 #endif
103
104 #endif  // VP9_DECODER_VP9_DECODER_H_