| File: | root/firefox-clang/media/ffvpx/libavcodec/vp9dec.h |
| Warning: | line 173, column 8 Excessive padding in 'struct VP9TileData' (100 padding bytes, where 36 is optimal). Optimal fields order: tmp_y, tmp_uv, edge_emu_buffer, left_y_nnz_ctx, left_mode_ctx, left_uv_nnz_ctx, left_mv_ctx, s, c_b, c, y_stride, uv_stride, b_base, b, left_partition_ctx, left_skip_ctx, left_txfm_ctx, left_segpred_ctx, left_intra_ctx, left_comp_ctx, left_ref_ctx, left_filter_ctx, block_base, block, eob_base, eob, block_structure, uvblock_base, uvblock, uveob_base, uveob, dst, row, row7, col, col7, tile_col_start, error_info, nb_block_structure, min_mv, max_mv, counts, consider reordering the fields or adding explicit padding members |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* |
| 2 | * VP9 compatible video decoder |
| 3 | * |
| 4 | * Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com> |
| 5 | * Copyright (C) 2013 Clément Bœsch <u pkh me> |
| 6 | * |
| 7 | * This file is part of FFmpeg. |
| 8 | * |
| 9 | * FFmpeg is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU Lesser General Public |
| 11 | * License as published by the Free Software Foundation; either |
| 12 | * version 2.1 of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * FFmpeg is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * Lesser General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Lesser General Public |
| 20 | * License along with FFmpeg; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 22 | */ |
| 23 | |
| 24 | #ifndef AVCODEC_VP9DEC_H |
| 25 | #define AVCODEC_VP9DEC_H |
| 26 | |
| 27 | #include <stddef.h> |
| 28 | #include <stdint.h> |
| 29 | #include <stdatomic.h> |
| 30 | |
| 31 | #include "libavutil/mem_internal.h" |
| 32 | #include "libavutil/pixfmt.h" |
| 33 | #include "libavutil/thread.h" |
| 34 | |
| 35 | #include "get_bits.h" |
| 36 | #include "videodsp.h" |
| 37 | #include "vp9.h" |
| 38 | #include "vp9dsp.h" |
| 39 | #include "vp9shared.h" |
| 40 | #include "vpx_rac.h" |
| 41 | #include "cbs_vp9.h" |
| 42 | |
| 43 | #define REF_INVALID_SCALE0xFFFF 0xFFFF |
| 44 | |
| 45 | enum MVJoint { |
| 46 | MV_JOINT_ZERO, |
| 47 | MV_JOINT_H, |
| 48 | MV_JOINT_V, |
| 49 | MV_JOINT_HV, |
| 50 | }; |
| 51 | |
| 52 | typedef struct ProbContext { |
| 53 | uint8_t y_mode[4][9]; |
| 54 | uint8_t uv_mode[10][9]; |
| 55 | uint8_t filter[4][2]; |
| 56 | uint8_t mv_mode[7][3]; |
| 57 | uint8_t intra[4]; |
| 58 | uint8_t comp[5]; |
| 59 | uint8_t single_ref[5][2]; |
| 60 | uint8_t comp_ref[5]; |
| 61 | uint8_t tx32p[2][3]; |
| 62 | uint8_t tx16p[2][2]; |
| 63 | uint8_t tx8p[2]; |
| 64 | uint8_t skip[3]; |
| 65 | uint8_t mv_joint[3]; |
| 66 | struct { |
| 67 | uint8_t sign; |
| 68 | uint8_t classes[10]; |
| 69 | uint8_t class0; |
| 70 | uint8_t bits[10]; |
| 71 | uint8_t class0_fp[2][3]; |
| 72 | uint8_t fp[3]; |
| 73 | uint8_t class0_hp; |
| 74 | uint8_t hp; |
| 75 | } mv_comp[2]; |
| 76 | uint8_t partition[4][4][3]; |
| 77 | } ProbContext; |
| 78 | |
| 79 | typedef struct VP9Filter { |
| 80 | uint8_t level[8 * 8]; |
| 81 | uint8_t /* bit=col */ mask[2 /* 0=y, 1=uv */][2 /* 0=col, 1=row */] |
| 82 | [8 /* rows */][4 /* 0=16, 1=8, 2=4, 3=inner4 */]; |
| 83 | } VP9Filter; |
| 84 | |
| 85 | typedef struct VP9Block { |
| 86 | uint8_t seg_id, intra, comp, ref[2], mode[4], uvmode, skip; |
| 87 | enum FilterMode filter; |
| 88 | VP9mv mv[4 /* b_idx */][2 /* ref */]; |
| 89 | enum BlockSize bs; |
| 90 | enum TxfmMode tx, uvtx; |
| 91 | enum BlockLevel bl; |
| 92 | enum BlockPartition bp; |
| 93 | } VP9Block; |
| 94 | |
| 95 | typedef struct VP9TileData VP9TileData; |
| 96 | |
| 97 | typedef struct VP9Context { |
| 98 | VP9SharedContext s; |
| 99 | VP9TileData *td; |
| 100 | |
| 101 | CodedBitstreamContext *cbc; |
| 102 | CodedBitstreamFragment current_frag; |
| 103 | VP9RawFrame *header_ref; ///< RefStruct reference backing frame_header |
| 104 | VP9RawFrameHeader *frame_header; |
| 105 | |
| 106 | VP9DSPContext dsp; |
| 107 | VideoDSPContext vdsp; |
| 108 | GetBitContext gb; |
| 109 | VPXRangeCoder c; |
| 110 | int pass, active_tile_cols; |
| 111 | |
| 112 | #if HAVE_THREADS1 |
| 113 | pthread_mutex_t progress_mutex; |
| 114 | pthread_cond_t progress_cond; |
| 115 | atomic_int *entries; |
| 116 | unsigned pthread_init_cnt; |
| 117 | #endif |
| 118 | |
| 119 | uint8_t ss_h, ss_v; |
| 120 | uint8_t last_bpp, bpp_index, bytesperpixel; |
| 121 | uint8_t last_keyframe; |
| 122 | // sb_cols/rows, rows/cols and last_fmt are used for allocating all internal |
| 123 | // arrays, and are thus per-thread. w/h and gf_fmt are synced between threads |
| 124 | // and are therefore per-stream. pix_fmt represents the value in the header |
| 125 | // of the currently processed frame. |
| 126 | int w, h; |
| 127 | enum AVPixelFormat pix_fmt, last_fmt, gf_fmt; |
| 128 | unsigned sb_cols, sb_rows, rows, cols; |
| 129 | ProgressFrame next_refs[8]; |
| 130 | |
| 131 | struct { |
| 132 | uint8_t lim_lut[64]; |
| 133 | uint8_t mblim_lut[64]; |
| 134 | } filter_lut; |
| 135 | struct { |
| 136 | ProbContext p; |
| 137 | uint8_t coef[4][2][2][6][6][3]; |
| 138 | } prob_ctx[4]; |
| 139 | struct { |
| 140 | ProbContext p; |
| 141 | uint8_t coef[4][2][2][6][6][11]; |
| 142 | } prob; |
| 143 | |
| 144 | // contextual (above) cache |
| 145 | uint8_t *above_partition_ctx; |
| 146 | uint8_t *above_mode_ctx; |
| 147 | // FIXME maybe merge some of the below in a flags field? |
| 148 | uint8_t *above_y_nnz_ctx; |
| 149 | uint8_t *above_uv_nnz_ctx[2]; |
| 150 | uint8_t *above_skip_ctx; // 1bit |
| 151 | uint8_t *above_txfm_ctx; // 2bit |
| 152 | uint8_t *above_segpred_ctx; // 1bit |
| 153 | uint8_t *above_intra_ctx; // 1bit |
| 154 | uint8_t *above_comp_ctx; // 1bit |
| 155 | uint8_t *above_ref_ctx; // 2bit |
| 156 | uint8_t *above_filter_ctx; |
| 157 | VP9mv (*above_mv_ctx)[2]; |
| 158 | |
| 159 | // whole-frame cache |
| 160 | uint8_t *intra_pred_data[3]; |
| 161 | VP9Filter *lflvl; |
| 162 | |
| 163 | // block reconstruction intermediates |
| 164 | int block_alloc_using_2pass; |
| 165 | uint16_t mvscale[3][2]; |
| 166 | uint8_t mvstep[3][2]; |
| 167 | |
| 168 | // frame specific buffer pools |
| 169 | struct AVRefStructPool *frame_extradata_pool; |
| 170 | int frame_extradata_pool_size; |
| 171 | } VP9Context; |
| 172 | |
| 173 | struct VP9TileData { |
Excessive padding in 'struct VP9TileData' (100 padding bytes, where 36 is optimal). Optimal fields order: tmp_y, tmp_uv, edge_emu_buffer, left_y_nnz_ctx, left_mode_ctx, left_uv_nnz_ctx, left_mv_ctx, s, c_b, c, y_stride, uv_stride, b_base, b, left_partition_ctx, left_skip_ctx, left_txfm_ctx, left_segpred_ctx, left_intra_ctx, left_comp_ctx, left_ref_ctx, left_filter_ctx, block_base, block, eob_base, eob, block_structure, uvblock_base, uvblock, uveob_base, uveob, dst, row, row7, col, col7, tile_col_start, error_info, nb_block_structure, min_mv, max_mv, counts, consider reordering the fields or adding explicit padding members | |
| 174 | const VP9Context *s; |
| 175 | VPXRangeCoder *c_b; |
| 176 | VPXRangeCoder *c; |
| 177 | int row, row7, col, col7; |
| 178 | uint8_t *dst[3]; |
| 179 | ptrdiff_t y_stride, uv_stride; |
| 180 | VP9Block *b_base, *b; |
| 181 | unsigned tile_col_start; |
| 182 | |
| 183 | struct { |
| 184 | unsigned y_mode[4][10]; |
| 185 | unsigned uv_mode[10][10]; |
| 186 | unsigned filter[4][3]; |
| 187 | unsigned mv_mode[7][4]; |
| 188 | unsigned intra[4][2]; |
| 189 | unsigned comp[5][2]; |
| 190 | unsigned single_ref[5][2][2]; |
| 191 | unsigned comp_ref[5][2]; |
| 192 | unsigned tx32p[2][4]; |
| 193 | unsigned tx16p[2][3]; |
| 194 | unsigned tx8p[2][2]; |
| 195 | unsigned skip[3][2]; |
| 196 | unsigned mv_joint[4]; |
| 197 | struct { |
| 198 | unsigned sign[2]; |
| 199 | unsigned classes[11]; |
| 200 | unsigned class0[2]; |
| 201 | unsigned bits[10][2]; |
| 202 | unsigned class0_fp[2][4]; |
| 203 | unsigned fp[4]; |
| 204 | unsigned class0_hp[2]; |
| 205 | unsigned hp[2]; |
| 206 | } mv_comp[2]; |
| 207 | unsigned partition[4][4][4]; |
| 208 | unsigned coef[4][2][2][6][6][3]; |
| 209 | unsigned eob[4][2][2][6][6][2]; |
| 210 | } counts; |
| 211 | |
| 212 | // whole-frame cache |
| 213 | DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)_Alignas(32) uint8_t edge_emu_buffer[135 * 144 * 2]; |
| 214 | |
| 215 | // contextual (left) cache |
| 216 | DECLARE_ALIGNED(16, uint8_t, left_y_nnz_ctx)_Alignas(16) uint8_t left_y_nnz_ctx[16]; |
| 217 | DECLARE_ALIGNED(16, uint8_t, left_mode_ctx)_Alignas(16) uint8_t left_mode_ctx[16]; |
| 218 | DECLARE_ALIGNED(16, VP9mv, left_mv_ctx)_Alignas(16) VP9mv left_mv_ctx[16][2]; |
| 219 | DECLARE_ALIGNED(16, uint8_t, left_uv_nnz_ctx)_Alignas(16) uint8_t left_uv_nnz_ctx[2][16]; |
| 220 | DECLARE_ALIGNED(8, uint8_t, left_partition_ctx)_Alignas(8) uint8_t left_partition_ctx[8]; |
| 221 | DECLARE_ALIGNED(8, uint8_t, left_skip_ctx)_Alignas(8) uint8_t left_skip_ctx[8]; |
| 222 | DECLARE_ALIGNED(8, uint8_t, left_txfm_ctx)_Alignas(8) uint8_t left_txfm_ctx[8]; |
| 223 | DECLARE_ALIGNED(8, uint8_t, left_segpred_ctx)_Alignas(8) uint8_t left_segpred_ctx[8]; |
| 224 | DECLARE_ALIGNED(8, uint8_t, left_intra_ctx)_Alignas(8) uint8_t left_intra_ctx[8]; |
| 225 | DECLARE_ALIGNED(8, uint8_t, left_comp_ctx)_Alignas(8) uint8_t left_comp_ctx[8]; |
| 226 | DECLARE_ALIGNED(8, uint8_t, left_ref_ctx)_Alignas(8) uint8_t left_ref_ctx[8]; |
| 227 | DECLARE_ALIGNED(8, uint8_t, left_filter_ctx)_Alignas(8) uint8_t left_filter_ctx[8]; |
| 228 | // block reconstruction intermediates |
| 229 | DECLARE_ALIGNED(64, uint8_t, tmp_y)_Alignas(64) uint8_t tmp_y[64 * 64 * 2]; |
| 230 | DECLARE_ALIGNED(64, uint8_t, tmp_uv)_Alignas(64) uint8_t tmp_uv[2][64 * 64 * 2]; |
| 231 | struct { int x, y; } min_mv, max_mv; |
| 232 | int16_t *block_base, *block, *uvblock_base[2], *uvblock[2]; |
| 233 | uint8_t *eob_base, *uveob_base[2], *eob, *uveob[2]; |
| 234 | |
| 235 | // error message |
| 236 | int error_info; |
| 237 | struct { |
| 238 | unsigned int row:13; |
| 239 | unsigned int col:13; |
| 240 | unsigned int block_size_idx_x:2; |
| 241 | unsigned int block_size_idx_y:2; |
| 242 | } *block_structure; |
| 243 | unsigned int nb_block_structure; |
| 244 | }; |
| 245 | |
| 246 | void ff_vp9_fill_mv(VP9TileData *td, VP9mv *mv, int mode, int sb); |
| 247 | |
| 248 | void ff_vp9_adapt_probs(VP9Context *s); |
| 249 | |
| 250 | void ff_vp9_decode_block(VP9TileData *td, int row, int col, |
| 251 | VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff, |
| 252 | enum BlockLevel bl, enum BlockPartition bp); |
| 253 | |
| 254 | void ff_vp9_loopfilter_sb(struct AVCodecContext *avctx, VP9Filter *lflvl, |
| 255 | int row, int col, ptrdiff_t yoff, ptrdiff_t uvoff); |
| 256 | |
| 257 | void ff_vp9_intra_recon_8bpp(VP9TileData *td, |
| 258 | ptrdiff_t y_off, ptrdiff_t uv_off); |
| 259 | void ff_vp9_intra_recon_16bpp(VP9TileData *td, |
| 260 | ptrdiff_t y_off, ptrdiff_t uv_off); |
| 261 | void ff_vp9_inter_recon_8bpp(VP9TileData *td); |
| 262 | void ff_vp9_inter_recon_16bpp(VP9TileData *td); |
| 263 | |
| 264 | #endif /* AVCODEC_VP9DEC_H */ |