| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: Copyright (c) 1993-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 3 |
* SPDX-License-Identifier: MIT |
| 4 |
* |
| 5 |
* Permission is hereby granted, free of charge, to any person obtaining a |
| 6 |
* copy of this software and associated documentation files (the "Software"), |
| 7 |
* to deal in the Software without restriction, including without limitation |
| 8 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 9 |
* and/or sell copies of the Software, and to permit persons to whom the |
| 10 |
* Software is furnished to do so, subject to the following conditions: |
| 11 |
* |
| 12 |
* The above copyright notice and this permission notice shall be included in |
| 13 |
* all copies or substantial portions of the Software. |
| 14 |
* |
| 15 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 21 |
* DEALINGS IN THE SOFTWARE. |
| 22 |
*/ |
| 23 |
|
| 24 |
#ifndef __NVDEC_DRV_H_ |
| 25 |
#define __NVDEC_DRV_H_ |
| 26 |
|
| 27 |
// TODO: Many fields can be converted to bitfields to save memory BW |
| 28 |
// TODO: Revisit reserved fields for proper alignment and memory savings |
| 29 |
|
| 30 |
/////////////////////////////////////////////////////////////////////////////// |
| 31 |
// NVDEC(MSDEC 5) is a single engine solution, and seperates into VLD, MV, IQT, |
| 32 |
// MCFETCH, MC, MCC, REC, DBF, DFBFDMA, HIST etc unit. |
| 33 |
// The class(driver to HW) can mainly seperate into VLD parser |
| 34 |
// and Decoder part to be consistent with original design. And |
| 35 |
// the sequence level info usally set in VLD part. Later codec like |
| 36 |
// VP8 won't name in this way. |
| 37 |
// MSVLD: Multi-Standard VLD parser. |
| 38 |
// |
| 39 |
#define ALIGN_UP(v, n) (((v) + ((n)-1)) &~ ((n)-1)) |
| 40 |
#define NVDEC_ALIGN(value) ALIGN_UP(value,256) // Align to 256 bytes |
| 41 |
#define NVDEC_MAX_MPEG2_SLICE 65536 // at 4096*4096, macroblock count = 65536, 1 macroblock per slice |
| 42 |
|
| 43 |
#define NVDEC_CODEC_MPEG1 0 |
| 44 |
#define NVDEC_CODEC_MPEG2 1 |
| 45 |
#define NVDEC_CODEC_VC1 2 |
| 46 |
#define NVDEC_CODEC_H264 3 |
| 47 |
#define NVDEC_CODEC_MPEG4 4 |
| 48 |
#define NVDEC_CODEC_DIVX NVDEC_CODEC_MPEG4 |
| 49 |
#define NVDEC_CODEC_VP8 5 |
| 50 |
#define NVDEC_CODEC_HEVC 7 |
| 51 |
#define NVDEC_CODEC_VP9 9 |
| 52 |
#define NVDEC_CODEC_HEVC_PARSER 12 |
| 53 |
#define NVDEC_CODEC_AV1 10 |
| 54 |
|
| 55 |
// AES encryption |
| 56 |
enum |
| 57 |
{ |
| 58 |
AES128_NONE = 0x0, |
| 59 |
AES128_CTR = 0x1, |
| 60 |
AES128_CBC, |
| 61 |
AES128_ECB, |
| 62 |
AES128_OFB, |
| 63 |
AES128_CTR_LSB16B, |
| 64 |
AES128_CLR_AS_ENCRYPT, |
| 65 |
AES128_RESERVED = 0x7 |
| 66 |
}; |
| 67 |
|
| 68 |
enum |
| 69 |
{ |
| 70 |
AES128_CTS_DISABLE = 0x0, |
| 71 |
AES128_CTS_ENABLE = 0x1 |
| 72 |
}; |
| 73 |
|
| 74 |
enum |
| 75 |
{ |
| 76 |
AES128_PADDING_NONE = 0x0, |
| 77 |
AES128_PADDING_CARRY_OVER, |
| 78 |
AES128_PADDING_RFC2630, |
| 79 |
AES128_PADDING_RESERVED = 0x7 |
| 80 |
}; |
| 81 |
|
| 82 |
typedef enum |
| 83 |
{ |
| 84 |
ENCR_MODE_CTR64 = 0, |
| 85 |
ENCR_MODE_CBC = 1, |
| 86 |
ENCR_MODE_ECB = 2, |
| 87 |
ENCR_MODE_ECB_PARTIAL = 3, |
| 88 |
ENCR_MODE_CBC_PARTIAL = 4, |
| 89 |
ENCR_MODE_CLEAR_INTO_VPR = 5, // used for clear stream decoding into VPR. |
| 90 |
ENCR_MODE_FORCE_INTO_VPR = 6, // used to force decode output into VPR. |
| 91 |
} ENCR_MODE; |
| 92 |
|
| 93 |
// drm_mode configuration |
| 94 |
// |
| 95 |
// Bit 0:2 AES encryption mode |
| 96 |
// Bit 3 CTS (CipherTextStealing) enable/disable |
| 97 |
// Bit 4:6 Padding type |
| 98 |
// Bit 7:7 Unwrap key enable/disable |
| 99 |
|
| 100 |
#define AES_MODE_MASK 0x7 |
| 101 |
#define AES_CTS_MASK 0x1 |
| 102 |
#define AES_PADDING_TYPE_MASK 0x7 |
| 103 |
#define AES_UNWRAP_KEY_MASK 0x1 |
| 104 |
|
| 105 |
#define AES_MODE_SHIFT 0 |
| 106 |
#define AES_CTS_SHIFT 3 |
| 107 |
#define AES_PADDING_TYPE_SHIFT 4 |
| 108 |
#define AES_UNWRAP_KEY_SHIFT 7 |
| 109 |
|
| 110 |
#define AES_SET_FLAG(M, C, P) ((M & AES_MODE_MASK) << AES_MODE_SHIFT) | \ |
| 111 |
((C & AES_CTS_MASK) << AES_CTS_SHIFT) | \ |
| 112 |
((P & AES_PADDING_TYPE_MASK) << AES_PADDING_TYPE_SHIFT) |
| 113 |
|
| 114 |
#define AES_GET_FLAG(V, F) ((V & ((AES_##F##_MASK) <<(AES_##F##_SHIFT))) >> (AES_##F##_SHIFT)) |
| 115 |
|
| 116 |
#define DRM_MODE_MASK 0x7f // Bits 0:6 (0:2 -> AES_MODE, 3 -> AES_CTS, 4:6 -> AES_PADDING_TYPE) |
| 117 |
#define AES_GET_DRM_MODE(V) (V & DRM_MODE_MASK) |
| 118 |
|
| 119 |
enum { DRM_MS_PIFF_CTR = AES_SET_FLAG(AES128_CTR, AES128_CTS_DISABLE, AES128_PADDING_CARRY_OVER) }; |
| 120 |
enum { DRM_MS_PIFF_CBC = AES_SET_FLAG(AES128_CBC, AES128_CTS_DISABLE, AES128_PADDING_NONE) }; |
| 121 |
enum { DRM_MARLIN_CTR = AES_SET_FLAG(AES128_CTR, AES128_CTS_DISABLE, AES128_PADDING_NONE) }; |
| 122 |
enum { DRM_MARLIN_CBC = AES_SET_FLAG(AES128_CBC, AES128_CTS_DISABLE, AES128_PADDING_RFC2630) }; |
| 123 |
enum { DRM_WIDEVINE = AES_SET_FLAG(AES128_CBC, AES128_CTS_ENABLE, AES128_PADDING_NONE) }; |
| 124 |
enum { DRM_WIDEVINE_CTR = AES_SET_FLAG(AES128_CTR, AES128_CTS_DISABLE, AES128_PADDING_CARRY_OVER) }; |
| 125 |
enum { DRM_ULTRA_VIOLET = AES_SET_FLAG(AES128_CTR_LSB16B, AES128_CTS_DISABLE, AES128_PADDING_NONE) }; |
| 126 |
enum { DRM_NONE = AES_SET_FLAG(AES128_NONE, AES128_CTS_DISABLE, AES128_PADDING_NONE) }; |
| 127 |
enum { DRM_CLR_AS_ENCRYPT = AES_SET_FLAG(AES128_CLR_AS_ENCRYPT, AES128_CTS_DISABLE, AES128_PADDING_NONE)}; |
| 128 |
|
| 129 |
// SSM entry structure |
| 130 |
typedef struct _nvdec_ssm_s { |
| 131 |
unsigned int bytes_of_protected_data;//bytes of protected data, follows bytes_of_clear_data. Note: When padding is enabled, it does not include the padding_bytes (1~15), which can be derived by "(16-(bytes_of_protected_data&0xF))&0xF" |
| 132 |
unsigned int bytes_of_clear_data:16; //bytes of clear data, located before bytes_of_protected_data |
| 133 |
unsigned int skip_byte_blk : 4; //valid when (entry_type==0 && mode = 1) |
| 134 |
unsigned int crypt_byte_blk : 4; //valid when (entry_type==0 && mode = 1) |
| 135 |
unsigned int skip : 1; //whether this SSM entry should be skipped or not |
| 136 |
unsigned int last : 1; //whether this SSM entry is the last one for the whole decoding frame |
| 137 |
unsigned int pad : 1; //valid when (entry_type==0 && mode==0 && AES_PADDING_TYPE==AES128_PADDING_RFC2630), 0 for pad_end, 1 for pad_begin |
| 138 |
unsigned int mode : 1; //0 for normal mode, 1 for pattern mode |
| 139 |
unsigned int entry_type : 1; //0 for DATA, 1 for IV |
| 140 |
unsigned int reserved : 3; |
| 141 |
} nvdec_ssm_s; /* SubSampleMap, 8bytes */ |
| 142 |
|
| 143 |
// PASS2 OTF extension structure for SSM support, not exist in nvdec_mpeg4_pic_s (as MPEG4 OTF SW-DRM is not supported yet) |
| 144 |
typedef struct _nvdec_pass2_otf_ext_s { |
| 145 |
unsigned int ssm_entry_num :16; //specifies how many SSM entries (each in unit of 8 bytes) existed in SET_SUB_SAMPLE_MAP_OFFSET surface |
| 146 |
unsigned int ssm_iv_num :16; //specifies how many SSM IV (each in unit of 16 bytes) existed in SET_SUB_SAMPLE_MAP_IV_OFFSET surface |
| 147 |
unsigned int real_stream_length; //the real stream length, which is the bitstream length EMD/VLD will get after whole frame SSM processing, sum up of "clear+protected" bytes in SSM entries and removing "non_slice_data/skip". |
| 148 |
unsigned int non_slice_data :16; //specifies the first many bytes needed to skip, includes only those of "clear+protected" bytes ("padding" bytes excluded) |
| 149 |
unsigned int drm_mode : 7; |
| 150 |
unsigned int reserved : 9; |
| 151 |
} nvdec_pass2_otf_ext_s; /* 12bytes */ |
| 152 |
|
| 153 |
|
| 154 |
//NVDEC5.0 low latency decoding (partial stream kickoff without context switch), method will reuse HevcSetSliceInfoBufferOffset. |
| 155 |
typedef struct _nvdec_substream_entry_s { |
| 156 |
unsigned int substream_start_offset; //substream byte start offset to bitstream base address |
| 157 |
unsigned int substream_length; //subsream length in byte |
| 158 |
unsigned int substream_first_tile_idx : 8; //the first tile index(raster scan in frame) of this substream,max is 255 |
| 159 |
unsigned int substream_last_tile_idx : 8; //the last tile index(raster scan in frame) of this substream, max is 255 |
| 160 |
unsigned int last_substream_entry_in_frame : 1; //this entry is the last substream entry of this frame |
| 161 |
unsigned int reserved : 15; |
| 162 |
} nvdec_substream_entry_s;/*low latency without context switch substream entry map,12bytes*/ |
| 163 |
|
| 164 |
|
| 165 |
// GIP |
| 166 |
|
| 167 |
/* tile border coefficients of filter */ |
| 168 |
#define GIP_ASIC_VERT_FILTER_RAM_SIZE 16 /* bytes per pixel */ |
| 169 |
|
| 170 |
/* BSD control data of current picture at tile border |
| 171 |
* 11 * 128 bits per 4x4 tile = 128/(8*4) bytes per row */ |
| 172 |
#define GIP_ASIC_BSD_CTRL_RAM_SIZE 4 /* bytes per row */ |
| 173 |
|
| 174 |
/* 8 dc + 8 to boundary + 6*16 + 2*6*64 + 2*64 -> 63 * 16 bytes */ |
| 175 |
#define GIP_ASIC_SCALING_LIST_SIZE (16*64) |
| 176 |
|
| 177 |
/* tile border coefficients of filter */ |
| 178 |
#define GIP_ASIC_VERT_SAO_RAM_SIZE 16 /* bytes per pixel */ |
| 179 |
|
| 180 |
/* max number of tiles times width and height (2 bytes each), |
| 181 |
* rounding up to next 16 bytes boundary + one extra 16 byte |
| 182 |
* chunk (HW guys wanted to have this) */ |
| 183 |
#define GIP_ASIC_TILE_SIZE ((20*22*2*2+16+15) & ~0xF) |
| 184 |
|
| 185 |
/* Segment map uses 32 bytes / CTB */ |
| 186 |
#define GIP_ASIC_VP9_CTB_SEG_SIZE 32 |
| 187 |
|
| 188 |
// HEVC Filter FG buffer |
| 189 |
#define HEVC_DBLK_TOP_SIZE_IN_SB16 ALIGN_UP(632, 128) // ctb16 + 444 |
| 190 |
#define HEVC_DBLK_TOP_BUF_SIZE(w) NVDEC_ALIGN( (ALIGN_UP(w,16)/16 + 2) * HEVC_DBLK_TOP_SIZE_IN_SB16) // 8K: 1285*256 |
| 191 |
|
| 192 |
#define HEVC_DBLK_LEFT_SIZE_IN_SB16 ALIGN_UP(506, 128) // ctb16 + 444 |
| 193 |
#define HEVC_DBLK_LEFT_BUF_SIZE(h) NVDEC_ALIGN( (ALIGN_UP(h,16)/16 + 2) * HEVC_DBLK_LEFT_SIZE_IN_SB16) // 8K: 1028*256 |
| 194 |
|
| 195 |
#define HEVC_SAO_LEFT_SIZE_IN_SB16 ALIGN_UP(713, 128) // ctb16 + 444 |
| 196 |
#define HEVC_SAO_LEFT_BUF_SIZE(h) NVDEC_ALIGN( (ALIGN_UP(h,16)/16 + 2) * HEVC_SAO_LEFT_SIZE_IN_SB16) // 8K: 1542*256 |
| 197 |
|
| 198 |
// VP9 Filter FG buffer |
| 199 |
#define VP9_DBLK_TOP_SIZE_IN_SB64 ALIGN_UP(2000, 128) // 420 |
| 200 |
#define VP9_DBLK_TOP_BUF_SIZE(w) NVDEC_ALIGN( (ALIGN_UP(w,64)/64 + 2) * VP9_DBLK_TOP_SIZE_IN_SB64) // 8K: 1040*256 |
| 201 |
|
| 202 |
#define VP9_DBLK_LEFT_SIZE_IN_SB64 ALIGN_UP(1600, 128) // 420 |
| 203 |
#define VP9_DBLK_LEFT_BUF_SIZE(h) NVDEC_ALIGN( (ALIGN_UP(h,64)/64 + 2) * VP9_DBLK_LEFT_SIZE_IN_SB64) // 8K: 845*256 |
| 204 |
|
| 205 |
// VP9 Hint Dump Buffer |
| 206 |
#define VP9_HINT_DUMP_SIZE_IN_SB64 ((64*64)/(4*4)*8) // 8 bytes per CU, 256 CUs(2048 bytes) per SB64 |
| 207 |
#define VP9_HINT_DUMP_SIZE(w, h) NVDEC_ALIGN(VP9_HINT_DUMP_SIZE_IN_SB64*((w+63)/64)*((h+63)/64)) |
| 208 |
|
| 209 |
// used for ecdma debug |
| 210 |
typedef struct _nvdec_ecdma_config_s |
| 211 |
{ |
| 212 |
unsigned int ecdma_enable; // enable/disable ecdma |
| 213 |
unsigned short ecdma_blk_x_src; // src start position x , it's 64x aligned |
| 214 |
unsigned short ecdma_blk_y_src; // src start position y , it's 8x aligned |
| 215 |
unsigned short ecdma_blk_x_dst; // dst start position x , it's 64x aligned |
| 216 |
unsigned short ecdma_blk_y_dst; // dst start position y , it's 8x aligned |
| 217 |
unsigned short ref_pic_idx; // ref(src) picture index , used to derived source picture base address |
| 218 |
unsigned short boundary0_top; // src insided tile/partition region top boundary |
| 219 |
unsigned short boundary0_bottom; // src insided tile/partition region bottom boundary |
| 220 |
unsigned short boundary1_left; // src insided tile/partition region left boundary |
| 221 |
unsigned short boundary1_right; // src insided tile/partition region right boundary |
| 222 |
unsigned char blk_copy_flag; // blk_copy enable flag. |
| 223 |
// if it's 1 ,ctb_size ==3,ecdma_blk_x_src == boundary1_left and ecdma_blk_y_src == boundary0_top ; |
| 224 |
// if it's 0 ,ecdma_blk_x_src == ecdma_blk_x_dst and ecdma_blk_y_src == ecdma_blk_y_dst; |
| 225 |
unsigned char ctb_size; // ctb_size .0:64x64,1:32x32,2:16x16,3:8x8 |
| 226 |
} nvdec_ecdma_config_s; |
| 227 |
|
| 228 |
typedef struct _nvdec_status_hevc_s |
| 229 |
{ |
| 230 |
unsigned int frame_status_intra_cnt; //Intra block counter, in unit of 8x8 block, IPCM block included |
| 231 |
unsigned int frame_status_inter_cnt; //Inter block counter, in unit of 8x8 block, SKIP block included |
| 232 |
unsigned int frame_status_skip_cnt; //Skip block counter, in unit of 4x4 block, blocks having NO/ZERO texture/coeff data |
| 233 |
unsigned int frame_status_fwd_mvx_cnt; //ABS sum of forward MVx, one 14bit MVx(integer) per 4x4 block |
| 234 |
unsigned int frame_status_fwd_mvy_cnt; //ABS sum of forward MVy, one 14bit MVy(integer) per 4x4 block |
| 235 |
unsigned int frame_status_bwd_mvx_cnt; //ABS sum of backward MVx, one 14bit MVx(integer) per 4x4 block |
| 236 |
unsigned int frame_status_bwd_mvy_cnt; //ABS sum of backward MVy, one 14bit MVy(integer) per 4x4 block |
| 237 |
unsigned int error_ctb_pos; //[15:0] error ctb position in Y direction, [31:16] error ctb position in X direction |
| 238 |
unsigned int error_slice_pos; //[15:0] error slice position in Y direction, [31:16] error slice position in X direction |
| 239 |
} nvdec_status_hevc_s; |
| 240 |
|
| 241 |
typedef struct _nvdec_status_vp9_s |
| 242 |
{ |
| 243 |
unsigned int frame_status_intra_cnt; //Intra block counter, in unit of 8x8 block, IPCM block included |
| 244 |
unsigned int frame_status_inter_cnt; //Inter block counter, in unit of 8x8 block, SKIP block included |
| 245 |
unsigned int frame_status_skip_cnt; //Skip block counter, in unit of 4x4 block, blocks having NO/ZERO texture/coeff data |
| 246 |
unsigned int frame_status_fwd_mvx_cnt; //ABS sum of forward MVx, one 14bit MVx(integer) per 4x4 block |
| 247 |
unsigned int frame_status_fwd_mvy_cnt; //ABS sum of forward MVy, one 14bit MVy(integer) per 4x4 block |
| 248 |
unsigned int frame_status_bwd_mvx_cnt; //ABS sum of backward MVx, one 14bit MVx(integer) per 4x4 block |
| 249 |
unsigned int frame_status_bwd_mvy_cnt; //ABS sum of backward MVy, one 14bit MVy(integer) per 4x4 block |
| 250 |
unsigned int error_ctb_pos; //[15:0] error ctb position in Y direction, [31:16] error ctb position in X direction |
| 251 |
unsigned int error_slice_pos; //[15:0] error slice position in Y direction, [31:16] error slice position in X direction |
| 252 |
} nvdec_status_vp9_s; |
| 253 |
|
| 254 |
typedef struct _nvdec_status_s |
| 255 |
{ |
| 256 |
unsigned int mbs_correctly_decoded; // total numers of correctly decoded macroblocks |
| 257 |
unsigned int mbs_in_error; // number of error macroblocks. |
| 258 |
unsigned int cycle_count; // total cycles taken for execute. read from PERF_DECODE_FRAME_V register |
| 259 |
unsigned int error_status; // report error if any |
| 260 |
union |
| 261 |
{ |
| 262 |
nvdec_status_hevc_s hevc; |
| 263 |
nvdec_status_vp9_s vp9; |
| 264 |
}; |
| 265 |
unsigned int slice_header_error_code; // report error in slice header |
| 266 |
|
| 267 |
} nvdec_status_s; |
| 268 |
|
| 269 |
// per 16x16 block, used in hevc/vp9 surface of SetExternalMVBufferOffset when error_external_mv_en = 1 |
| 270 |
typedef struct _external_mv_s |
| 271 |
{ |
| 272 |
int mvx : 14; //integrate pixel precision |
| 273 |
int mvy : 14; //integrate pixel precision |
| 274 |
unsigned int refidx : 4; |
| 275 |
} external_mv_s; |
| 276 |
|
| 277 |
// HEVC |
| 278 |
typedef struct _nvdec_hevc_main10_444_ext_s |
| 279 |
{ |
| 280 |
unsigned int transformSkipRotationEnableFlag : 1; //sps extension for transform_skip_rotation_enabled_flag |
| 281 |
unsigned int transformSkipContextEnableFlag : 1; //sps extension for transform_skip_context_enabled_flag |
| 282 |
unsigned int intraBlockCopyEnableFlag :1; //sps intraBlockCopyEnableFlag, always 0 before spec define it |
| 283 |
unsigned int implicitRdpcmEnableFlag : 1; //sps implicit_rdpcm_enabled_flag |
| 284 |
unsigned int explicitRdpcmEnableFlag : 1; //sps explicit_rdpcm_enabled_flag |
| 285 |
unsigned int extendedPrecisionProcessingFlag : 1; //sps extended_precision_processing_flag,always 0 in current profile |
| 286 |
unsigned int intraSmoothingDisabledFlag : 1; //sps intra_smoothing_disabled_flag |
| 287 |
unsigned int highPrecisionOffsetsEnableFlag :1; //sps high_precision_offsets_enabled_flag |
| 288 |
unsigned int fastRiceAdaptationEnableFlag: 1; //sps fast_rice_adaptation_enabled_flag |
| 289 |
unsigned int cabacBypassAlignmentEnableFlag : 1; //sps cabac_bypass_alignment_enabled_flag, always 0 in current profile |
| 290 |
unsigned int sps_444_extension_reserved : 22; //sps reserve for future extension |
| 291 |
|
| 292 |
unsigned int log2MaxTransformSkipSize : 4 ; //pps extension log2_max_transform_skip_block_size_minus2, 0...5 |
| 293 |
unsigned int crossComponentPredictionEnableFlag: 1; //pps cross_component_prediction_enabled_flag |
| 294 |
unsigned int chromaQpAdjustmentEnableFlag:1; //pps chroma_qp_adjustment_enabled_flag |
| 295 |
unsigned int diffCuChromaQpAdjustmentDepth:2; //pps diff_cu_chroma_qp_adjustment_depth, 0...3 |
| 296 |
unsigned int chromaQpAdjustmentTableSize:3; //pps chroma_qp_adjustment_table_size_minus1+1, 1...6 |
| 297 |
unsigned int log2SaoOffsetScaleLuma:3; //pps log2_sao_offset_scale_luma, max(0,bitdepth-10),maxBitdepth 16 for future. |
| 298 |
unsigned int log2SaoOffsetScaleChroma: 3; //pps log2_sao_offset_scale_chroma |
| 299 |
unsigned int pps_444_extension_reserved : 15; //pps reserved |
| 300 |
char cb_qp_adjustment[6]; //-[12,+12] |
| 301 |
char cr_qp_adjustment[6]; //-[12,+12] |
| 302 |
unsigned int HevcFltAboveOffset; // filter above offset respect to filter buffer, 256 bytes unit |
| 303 |
unsigned int HevcSaoAboveOffset; // sao above offset respect to filter buffer, 256 bytes unit |
| 304 |
} nvdec_hevc_main10_444_ext_s; |
| 305 |
|
| 306 |
typedef struct _nvdec_hevc_pic_v1_s |
| 307 |
{ |
| 308 |
// New fields |
| 309 |
//hevc main10 444 extensions |
| 310 |
nvdec_hevc_main10_444_ext_s hevc_main10_444_ext; |
| 311 |
|
| 312 |
//HEVC skip bytes from beginning setting for secure |
| 313 |
//it is different to the sw_hdr_skip_length who skips the middle of stream of |
| 314 |
//the slice header which is parsed by driver |
| 315 |
unsigned int sw_skip_start_length : 14; |
| 316 |
unsigned int external_ref_mem_dis : 1; |
| 317 |
unsigned int error_recovery_start_pos : 2; //0: from start of frame, 1: from start of slice segment, 2: from error detected ctb, 3: reserved |
| 318 |
unsigned int error_external_mv_en : 1; |
| 319 |
unsigned int reserved0 : 14; |
| 320 |
// Reserved bits padding |
| 321 |
} nvdec_hevc_pic_v1_s; |
| 322 |
|
| 323 |
//No versioning in structure: NVDEC2 (T210 and GM206) |
| 324 |
//version v1 : NVDEC3 (T186 and GP100) |
| 325 |
//version v2 : NVDEC3.1 (GP10x) |
| 326 |
|
| 327 |
typedef struct _nvdec_hevc_pic_v2_s |
| 328 |
{ |
| 329 |
// mv-hevc field |
| 330 |
unsigned int mv_hevc_enable :1; |
| 331 |
unsigned int nuh_layer_id :6; |
| 332 |
unsigned int default_ref_layers_active_flag :1; |
| 333 |
unsigned int NumDirectRefLayers :6; |
| 334 |
unsigned int max_one_active_ref_layer_flag :1; |
| 335 |
unsigned int NumActiveRefLayerPics :6; |
| 336 |
unsigned int poc_lsb_not_present_flag :1; |
| 337 |
unsigned int reserved0 :10; |
| 338 |
} nvdec_hevc_pic_v2_s; |
| 339 |
|
| 340 |
typedef struct _nvdec_hevc_pic_v3_s |
| 341 |
{ |
| 342 |
// slice level decoding |
| 343 |
unsigned int slice_decoding_enable:1;//1: enable slice level decoding |
| 344 |
unsigned int slice_ec_enable:1; //1: enable slice error concealment. When slice_ec_enable=1,slice_decoding_enable must be 1; |
| 345 |
unsigned int slice_ec_mv_type:2; //0: zero mv; 1: co-located mv; 2: external mv; |
| 346 |
unsigned int err_detected_sw:1; //1: indicate sw/driver has detected error already in frame kick mode |
| 347 |
unsigned int slice_ec_slice_type:2; //0: B slice; 1: P slice ; others: reserved |
| 348 |
unsigned int slice_strm_recfg_en:1; //enable slice bitstream re-configure or not ; |
| 349 |
unsigned int reserved:24; |
| 350 |
unsigned int HevcSliceEdgeOffset;// slice edge buffer offset which repsect to filter buffer ,256 bytes as one unit |
| 351 |
}nvdec_hevc_pic_v3_s; |
| 352 |
|
| 353 |
typedef struct _nvdec_hevc_pic_s |
| 354 |
{ |
| 355 |
//The key/IV addr must be 128bit alignment |
| 356 |
unsigned int wrapped_session_key[4]; //session keys |
| 357 |
unsigned int wrapped_content_key[4]; //content keys |
| 358 |
unsigned int initialization_vector[4]; //Ctrl64 initial vector |
| 359 |
// hevc_bitstream_data_info |
| 360 |
unsigned int stream_len; // stream length in one frame |
| 361 |
unsigned int enable_encryption; // flag to enable/disable encryption |
| 362 |
unsigned int key_increment : 6; // added to content key after unwrapping |
| 363 |
unsigned int encryption_mode : 4; |
| 364 |
unsigned int key_slot_index : 4; |
| 365 |
unsigned int ssm_en : 1; |
| 366 |
unsigned int enable_histogram : 1; // histogram stats output enable |
| 367 |
unsigned int enable_substream_decoding: 1; //frame substream kickoff without context switch |
| 368 |
unsigned int reserved0 :15; |
| 369 |
|
| 370 |
// Driver may or may not use based upon need. |
| 371 |
// If 0 then default value of 1<<27 = 298ms @ 450MHz will be used in ucode. |
| 372 |
// Driver can send this value based upon resolution using the formula: |
| 373 |
// gptimer_timeout_value = 3 * (cycles required for one frame) |
| 374 |
unsigned int gptimer_timeout_value; |
| 375 |
|
| 376 |
// general |
| 377 |
unsigned char tileformat : 2 ; // 0: TBL; 1: KBL; 2: Tile16x16 |
| 378 |
unsigned char gob_height : 3 ; // Set GOB height, 0: GOB_2, 1: GOB_4, 2: GOB_8, 3: GOB_16, 4: GOB_32 (NVDEC3 onwards) |
| 379 |
unsigned char reserverd_surface_format : 3 ; |
| 380 |
unsigned char sw_start_code_e; // 0: stream doesn't contain start codes,1: stream contains start codes |
| 381 |
unsigned char disp_output_mode; // 0: Rec.709 8 bit, 1: Rec.709 10 bit, 2: Rec.709 10 bits -> 8 bit, 3: Rec.2020 10 bit -> 8 bit |
| 382 |
unsigned char reserved1; |
| 383 |
unsigned int framestride[2]; // frame buffer stride for luma and chroma |
| 384 |
unsigned int colMvBuffersize; // collocated MV buffer size of one picture ,256 bytes unit |
| 385 |
unsigned int HevcSaoBufferOffset; // sao buffer offset respect to filter buffer ,256 bytes unit . |
| 386 |
unsigned int HevcBsdCtrlOffset; // bsd buffer offset respect to filter buffer ,256 bytes unit . |
| 387 |
// sps |
| 388 |
unsigned short pic_width_in_luma_samples; // :15, 48(?)..16384, multiple of 8 (48 is smallest width supported by NVDEC for CTU size 16x16) |
| 389 |
unsigned short pic_height_in_luma_samples; // :15, 8..16384, multiple of 8 |
| 390 |
unsigned int chroma_format_idc : 4; // always 1 (=4:2:0) |
| 391 |
unsigned int bit_depth_luma : 4; // 8..12 |
| 392 |
unsigned int bit_depth_chroma : 4; |
| 393 |
unsigned int log2_min_luma_coding_block_size : 4; // 3..6 |
| 394 |
unsigned int log2_max_luma_coding_block_size : 4; // 3..6 |
| 395 |
unsigned int log2_min_transform_block_size : 4; // 2..5 |
| 396 |
unsigned int log2_max_transform_block_size : 4; // 2..5 |
| 397 |
unsigned int reserved2 : 4; |
| 398 |
|
| 399 |
unsigned int max_transform_hierarchy_depth_inter : 3; // 0..4 |
| 400 |
unsigned int max_transform_hierarchy_depth_intra : 3; // 0..4 |
| 401 |
unsigned int scalingListEnable : 1; // |
| 402 |
unsigned int amp_enable_flag : 1; // |
| 403 |
unsigned int sample_adaptive_offset_enabled_flag : 1; // |
| 404 |
unsigned int pcm_enabled_flag : 1; // |
| 405 |
unsigned int pcm_sample_bit_depth_luma : 4; // |
| 406 |
unsigned int pcm_sample_bit_depth_chroma : 4; |
| 407 |
unsigned int log2_min_pcm_luma_coding_block_size : 4; // |
| 408 |
unsigned int log2_max_pcm_luma_coding_block_size : 4; // |
| 409 |
unsigned int pcm_loop_filter_disabled_flag : 1; // |
| 410 |
unsigned int sps_temporal_mvp_enabled_flag : 1; // |
| 411 |
unsigned int strong_intra_smoothing_enabled_flag : 1; // |
| 412 |
unsigned int reserved3 : 3; |
| 413 |
// pps |
| 414 |
unsigned int dependent_slice_segments_enabled_flag : 1; // |
| 415 |
unsigned int output_flag_present_flag : 1; // |
| 416 |
unsigned int num_extra_slice_header_bits : 3; // 0..7 (normally 0) |
| 417 |
unsigned int sign_data_hiding_enabled_flag : 1; // |
| 418 |
unsigned int cabac_init_present_flag : 1; // |
| 419 |
unsigned int num_ref_idx_l0_default_active : 4; // 1..15 |
| 420 |
unsigned int num_ref_idx_l1_default_active : 4; // 1..15 |
| 421 |
unsigned int init_qp : 7; // 0..127, support higher bitdepth |
| 422 |
unsigned int constrained_intra_pred_flag : 1; // |
| 423 |
unsigned int transform_skip_enabled_flag : 1; // |
| 424 |
unsigned int cu_qp_delta_enabled_flag : 1; // |
| 425 |
unsigned int diff_cu_qp_delta_depth : 2; // 0..3 |
| 426 |
unsigned int reserved4 : 5; // |
| 427 |
|
| 428 |
char pps_cb_qp_offset ; // -12..12 |
| 429 |
char pps_cr_qp_offset ; // -12..12 |
| 430 |
char pps_beta_offset ; // -12..12 |
| 431 |
char pps_tc_offset ; // -12..12 |
| 432 |
unsigned int pps_slice_chroma_qp_offsets_present_flag : 1; // |
| 433 |
unsigned int weighted_pred_flag : 1; // |
| 434 |
unsigned int weighted_bipred_flag : 1; // |
| 435 |
unsigned int transquant_bypass_enabled_flag : 1; // |
| 436 |
unsigned int tiles_enabled_flag : 1; // (redundant: = num_tile_columns_minus1!=0 || num_tile_rows_minus1!=0) |
| 437 |
unsigned int entropy_coding_sync_enabled_flag : 1; // |
| 438 |
unsigned int num_tile_columns : 5; // 0..20 |
| 439 |
unsigned int num_tile_rows : 5; // 0..22 |
| 440 |
unsigned int loop_filter_across_tiles_enabled_flag : 1; // |
| 441 |
unsigned int loop_filter_across_slices_enabled_flag : 1; // |
| 442 |
unsigned int deblocking_filter_control_present_flag : 1; // |
| 443 |
unsigned int deblocking_filter_override_enabled_flag : 1; // |
| 444 |
unsigned int pps_deblocking_filter_disabled_flag : 1; // |
| 445 |
unsigned int lists_modification_present_flag : 1; // |
| 446 |
unsigned int log2_parallel_merge_level : 3; // 2..4 |
| 447 |
unsigned int slice_segment_header_extension_present_flag : 1; // (normally 0) |
| 448 |
unsigned int reserved5 : 6; |
| 449 |
|
| 450 |
// reference picture related |
| 451 |
unsigned char num_ref_frames; |
| 452 |
unsigned char reserved6; |
| 453 |
unsigned short longtermflag; // long term flag for refpiclist.bit 15 for picidx 0, bit 14 for picidx 1,... |
| 454 |
unsigned char initreflistidxl0[16]; // :5, [refPicidx] 0..15 |
| 455 |
unsigned char initreflistidxl1[16]; // :5, [refPicidx] 0..15 |
| 456 |
short RefDiffPicOrderCnts[16]; // poc diff between current and reference pictures .[-128,127] |
| 457 |
// misc |
| 458 |
unsigned char IDR_picture_flag; // idr flag for current picture |
| 459 |
unsigned char RAP_picture_flag; // rap flag for current picture |
| 460 |
unsigned char curr_pic_idx; // current picture store buffer index,used to derive the store addess of frame buffer and MV |
| 461 |
unsigned char pattern_id; // used for dithering to select between 2 tables |
| 462 |
unsigned short sw_hdr_skip_length; // reference picture inititial related syntax elements(SE) bits in slice header. |
| 463 |
// those SE only decoding once in driver,related bits will flush in HW |
| 464 |
unsigned short reserved7; |
| 465 |
|
| 466 |
// used for ecdma debug |
| 467 |
nvdec_ecdma_config_s ecdma_cfg; |
| 468 |
|
| 469 |
//DXVA on windows |
| 470 |
unsigned int separate_colour_plane_flag : 1; |
| 471 |
unsigned int log2_max_pic_order_cnt_lsb_minus4 : 4; //0~12 |
| 472 |
unsigned int num_short_term_ref_pic_sets : 7 ; //0~64 |
| 473 |
unsigned int num_long_term_ref_pics_sps : 6; //0~32 |
| 474 |
unsigned int bBitParsingDisable : 1 ; //disable parsing |
| 475 |
unsigned int num_delta_pocs_of_rps_idx : 8; |
| 476 |
unsigned int long_term_ref_pics_present_flag : 1; |
| 477 |
unsigned int reserved_dxva : 4; |
| 478 |
//the number of bits for short_term_ref_pic_set()in slice header,dxva API |
| 479 |
unsigned int num_bits_short_term_ref_pics_in_slice; |
| 480 |
|
| 481 |
// New additions |
| 482 |
nvdec_hevc_pic_v1_s v1; |
| 483 |
nvdec_hevc_pic_v2_s v2; |
| 484 |
nvdec_hevc_pic_v3_s v3; |
| 485 |
nvdec_pass2_otf_ext_s ssm; |
| 486 |
|
| 487 |
} nvdec_hevc_pic_s; |
| 488 |
|
| 489 |
//hevc slice info class |
| 490 |
typedef struct _hevc_slice_info_s { |
| 491 |
unsigned int first_flag :1;//first slice(s) of frame,must valid for slice EC |
| 492 |
unsigned int err_flag :1;//error slice(s) .optional info for EC |
| 493 |
unsigned int last_flag :1;//last slice segment(s) of frame,this bit is must be valid when slice_strm_recfg_en==1 or slice_ec==1 |
| 494 |
unsigned int conceal_partial_slice :1; // indicate do partial slice error conealment for packet loss case |
| 495 |
unsigned int available :1; // indicate the slice bitstream is available. |
| 496 |
unsigned int reserved0 :7; |
| 497 |
unsigned int ctb_count :20;// ctbs counter inside slice(s) .must valid for slice EC |
| 498 |
unsigned int bs_offset; //slice(s) bitstream offset in bitstream buffer (in byte unit) |
| 499 |
unsigned int bs_length; //slice(s) bitstream length. It is sum of aligned size and skip size and valid slice bitstream size. |
| 500 |
unsigned short start_ctbx; //slice start ctbx ,it's optional,HW can output it in previous slice decoding. |
| 501 |
//but this is one check points for error |
| 502 |
unsigned short start_ctby; //slice start ctby |
| 503 |
} hevc_slice_info_s; |
| 504 |
|
| 505 |
|
| 506 |
//hevc slice ctx class |
| 507 |
//slice pos and next slice address |
| 508 |
typedef struct _slice_edge_ctb_pos_ctx_s { |
| 509 |
unsigned int next_slice_pos_ctbxy; //2d address in raster scan |
| 510 |
unsigned int next_slice_segment_addr; //1d address in tile scan |
| 511 |
}slice_edge_ctb_pos_ctx_s; |
| 512 |
|
| 513 |
// next slice's first ctb located tile related information |
| 514 |
typedef struct _slice_edge_tile_ctx_s { |
| 515 |
unsigned int tileInfo1;// Misc tile info includes tile width and tile height and tile col and tile row |
| 516 |
unsigned int tileInfo2;// Misc tile info includes tile start ctbx and start ctby and tile index |
| 517 |
unsigned int tileInfo3;// Misc tile info includes ctb pos inside tile |
| 518 |
} slice_edge_tile_ctx_s; |
| 519 |
|
| 520 |
//frame level stats |
| 521 |
typedef struct _slice_edge_stats_ctx_s { |
| 522 |
unsigned int frame_status_intra_cnt;// frame stats for intra block count |
| 523 |
unsigned int frame_status_inter_cnt;// frame stats for inter block count |
| 524 |
unsigned int frame_status_skip_cnt;// frame stats for skip block count |
| 525 |
unsigned int frame_status_fwd_mvx_cnt;// frame stats for sum of abs fwd mvx |
| 526 |
unsigned int frame_status_fwd_mvy_cnt;// frame stats for sum of abs fwd mvy |
| 527 |
unsigned int frame_status_bwd_mvx_cnt;// frame stats for sum of abs bwd mvx |
| 528 |
unsigned int frame_status_bwd_mvy_cnt;// frame stats for sum of abs bwd mvy |
| 529 |
unsigned int frame_status_mv_cnt_ext;// extension bits of sum of abs mv to keep full precision. |
| 530 |
}slice_edge_stats_ctx_s; |
| 531 |
|
| 532 |
//ctx of vpc_edge unit for tile left |
| 533 |
typedef struct _slice_vpc_edge_ctx_s { |
| 534 |
unsigned int reserved; |
| 535 |
}slice_vpc_edge_ctx_s; |
| 536 |
|
| 537 |
//ctx of vpc_main unit |
| 538 |
typedef struct _slice_vpc_main_ctx_s { |
| 539 |
unsigned int reserved; |
| 540 |
} slice_vpc_main_ctx_s; |
| 541 |
|
| 542 |
//hevc slice edge ctx class |
| 543 |
typedef struct _slice_edge_ctx_s { |
| 544 |
//ctb pos |
| 545 |
slice_edge_ctb_pos_ctx_s slice_ctb_pos_ctx; |
| 546 |
// stats |
| 547 |
slice_edge_stats_ctx_s slice_stats_ctx; |
| 548 |
// tile info |
| 549 |
slice_edge_tile_ctx_s slice_tile_ctx; |
| 550 |
//vpc_edge |
| 551 |
slice_vpc_edge_ctx_s slice_vpc_edge_ctx; |
| 552 |
//vpc_main |
| 553 |
slice_vpc_main_ctx_s slice_vpc_main_ctx; |
| 554 |
} slice_edge_ctx_s; |
| 555 |
|
| 556 |
//vp9 |
| 557 |
|
| 558 |
typedef struct _nvdec_vp9_pic_v1_s |
| 559 |
{ |
| 560 |
// New fields |
| 561 |
// new_var : xx; // for variables with expanded bitlength, comment on why the new bit legth is required |
| 562 |
// Reserved bits for padding and/or non-HW specific functionality |
| 563 |
unsigned int Vp9FltAboveOffset; // filter above offset respect to filter buffer, 256 bytes unit |
| 564 |
unsigned int external_ref_mem_dis : 1; |
| 565 |
unsigned int bit_depth : 4; |
| 566 |
unsigned int error_recovery_start_pos : 2; //0: from start of frame, 1: from start of slice segment, 2: from error detected ctb, 3: reserved |
| 567 |
unsigned int error_external_mv_en : 1; |
| 568 |
unsigned int Reserved0 : 24; |
| 569 |
} nvdec_vp9_pic_v1_s; |
| 570 |
|
| 571 |
enum VP9_FRAME_SFC_ID |
| 572 |
{ |
| 573 |
VP9_LAST_FRAME_SFC = 0, |
| 574 |
VP9_GOLDEN_FRAME_SFC, |
| 575 |
VP9_ALTREF_FRAME_SFC, |
| 576 |
VP9_CURR_FRAME_SFC |
| 577 |
}; |
| 578 |
|
| 579 |
typedef struct _nvdec_vp9_pic_s |
| 580 |
{ |
| 581 |
// vp9_bitstream_data_info |
| 582 |
//Key and IV address must 128bit alignment |
| 583 |
unsigned int wrapped_session_key[4]; //session keys |
| 584 |
unsigned int wrapped_content_key[4]; //content keys |
| 585 |
unsigned int initialization_vector[4]; //Ctrl64 initial vector |
| 586 |
unsigned int stream_len; // stream length in one frame |
| 587 |
unsigned int enable_encryption; // flag to enable/disable encryption |
| 588 |
unsigned int key_increment : 6; // added to content key after unwrapping |
| 589 |
unsigned int encryption_mode : 4; |
| 590 |
unsigned int sw_hdr_skip_length :14; //vp9 skip bytes setting for secure |
| 591 |
unsigned int key_slot_index : 4; |
| 592 |
unsigned int ssm_en : 1; |
| 593 |
unsigned int enable_histogram : 1; // histogram stats output enable |
| 594 |
unsigned int reserved0 : 2; |
| 595 |
|
| 596 |
// Driver may or may not use based upon need. |
| 597 |
// If 0 then default value of 1<<27 = 298ms @ 450MHz will be used in ucode. |
| 598 |
// Driver can send this value based upon resolution using the formula: |
| 599 |
// gptimer_timeout_value = 3 * (cycles required for one frame) |
| 600 |
unsigned int gptimer_timeout_value; |
| 601 |
|
| 602 |
//general |
| 603 |
unsigned char tileformat : 2 ; // 0: TBL; 1: KBL; 2: Tile16x16 |
| 604 |
unsigned char gob_height : 3 ; // Set GOB height, 0: GOB_2, 1: GOB_4, 2: GOB_8, 3: GOB_16, 4: GOB_32 (NVDEC3 onwards) |
| 605 |
unsigned char reserverd_surface_format : 3 ; |
| 606 |
unsigned char reserved1[3]; |
| 607 |
unsigned int Vp9BsdCtrlOffset; // bsd buffer offset respect to filter buffer ,256 bytes unit . |
| 608 |
|
| 609 |
|
| 610 |
//ref_last dimensions |
| 611 |
unsigned short ref0_width; //ref_last coded width |
| 612 |
unsigned short ref0_height; //ref_last coded height |
| 613 |
unsigned short ref0_stride[2]; //ref_last stride |
| 614 |
|
| 615 |
//ref_golden dimensions |
| 616 |
unsigned short ref1_width; //ref_golden coded width |
| 617 |
unsigned short ref1_height; //ref_golden coded height |
| 618 |
unsigned short ref1_stride[2]; //ref_golden stride |
| 619 |
|
| 620 |
//ref_alt dimensions |
| 621 |
unsigned short ref2_width; //ref_alt coded width |
| 622 |
unsigned short ref2_height; //ref_alt coded height |
| 623 |
unsigned short ref2_stride[2]; //ref_alt stride |
| 624 |
|
| 625 |
|
| 626 |
/* Current frame dimensions */ |
| 627 |
unsigned short width; //pic width |
| 628 |
unsigned short height; //pic height |
| 629 |
unsigned short framestride[2]; // frame buffer stride for luma and chroma |
| 630 |
|
| 631 |
unsigned char keyFrame :1; |
| 632 |
unsigned char prevIsKeyFrame:1; |
| 633 |
unsigned char resolutionChange:1; |
| 634 |
unsigned char errorResilient:1; |
| 635 |
unsigned char prevShowFrame:1; |
| 636 |
unsigned char intraOnly:1; |
| 637 |
unsigned char reserved2 : 2; |
| 638 |
|
| 639 |
/* DCT coefficient partitions */ |
| 640 |
//unsigned int offsetToDctParts; |
| 641 |
|
| 642 |
unsigned char reserved3[3]; |
| 643 |
//unsigned char activeRefIdx[3];//3 bits |
| 644 |
//unsigned char refreshFrameFlags; |
| 645 |
//unsigned char refreshEntropyProbs; |
| 646 |
//unsigned char frameParallelDecoding; |
| 647 |
//unsigned char resetFrameContext; |
| 648 |
|
| 649 |
unsigned char refFrameSignBias[4]; |
| 650 |
char loopFilterLevel;//6 bits |
| 651 |
char loopFilterSharpness;//3 bits |
| 652 |
|
| 653 |
/* Quantization parameters */ |
| 654 |
unsigned char qpYAc; |
| 655 |
char qpYDc; |
| 656 |
char qpChAc; |
| 657 |
char qpChDc; |
| 658 |
|
| 659 |
/* From here down, frame-to-frame persisting stuff */ |
| 660 |
|
| 661 |
char lossless; |
| 662 |
char transform_mode; |
| 663 |
char allow_high_precision_mv; |
| 664 |
char mcomp_filter_type; |
| 665 |
char comp_pred_mode; |
| 666 |
char comp_fixed_ref; |
| 667 |
char comp_var_ref[2]; |
| 668 |
char log2_tile_columns; |
| 669 |
char log2_tile_rows; |
| 670 |
|
| 671 |
/* Segment and macroblock specific values */ |
| 672 |
unsigned char segmentEnabled; |
| 673 |
unsigned char segmentMapUpdate; |
| 674 |
unsigned char segmentMapTemporalUpdate; |
| 675 |
unsigned char segmentFeatureMode; /* ABS data or delta data */ |
| 676 |
unsigned char segmentFeatureEnable[8][4]; |
| 677 |
short segmentFeatureData[8][4]; |
| 678 |
char modeRefLfEnabled; |
| 679 |
char mbRefLfDelta[4]; |
| 680 |
char mbModeLfDelta[2]; |
| 681 |
char reserved5; // for alignment |
| 682 |
|
| 683 |
// New additions |
| 684 |
nvdec_vp9_pic_v1_s v1; |
| 685 |
nvdec_pass2_otf_ext_s ssm; |
| 686 |
|
| 687 |
} nvdec_vp9_pic_s; |
| 688 |
|
| 689 |
#define NVDEC_VP9HWPAD(x, y) unsigned char x[y] |
| 690 |
|
| 691 |
typedef struct { |
| 692 |
/* last bytes of address 41 */ |
| 693 |
unsigned char joints[3]; |
| 694 |
unsigned char sign[2]; |
| 695 |
/* address 42 */ |
| 696 |
unsigned char class0[2][1]; |
| 697 |
unsigned char fp[2][3]; |
| 698 |
unsigned char class0_hp[2]; |
| 699 |
unsigned char hp[2]; |
| 700 |
unsigned char classes[2][10]; |
| 701 |
/* address 43 */ |
| 702 |
unsigned char class0_fp[2][2][3]; |
| 703 |
unsigned char bits[2][10]; |
| 704 |
|
| 705 |
} nvdec_nmv_context; |
| 706 |
|
| 707 |
typedef struct { |
| 708 |
unsigned int joints[4]; |
| 709 |
unsigned int sign[2][2]; |
| 710 |
unsigned int classes[2][11]; |
| 711 |
unsigned int class0[2][2]; |
| 712 |
unsigned int bits[2][10][2]; |
| 713 |
unsigned int class0_fp[2][2][4]; |
| 714 |
unsigned int fp[2][4]; |
| 715 |
unsigned int class0_hp[2][2]; |
| 716 |
unsigned int hp[2][2]; |
| 717 |
|
| 718 |
} nvdec_nmv_context_counts; |
| 719 |
|
| 720 |
/* Adaptive entropy contexts, padding elements are added to have |
| 721 |
* 256 bit aligned tables for HW access. |
| 722 |
* Compile with TRACE_PROB_TABLES to print bases for each table. */ |
| 723 |
typedef struct nvdec_vp9AdaptiveEntropyProbs_s |
| 724 |
{ |
| 725 |
/* address 32 */ |
| 726 |
unsigned char inter_mode_prob[7][4]; |
| 727 |
unsigned char intra_inter_prob[4]; |
| 728 |
|
| 729 |
/* address 33 */ |
| 730 |
unsigned char uv_mode_prob[10][8]; |
| 731 |
unsigned char tx8x8_prob[2][1]; |
| 732 |
unsigned char tx16x16_prob[2][2]; |
| 733 |
unsigned char tx32x32_prob[2][3]; |
| 734 |
unsigned char sb_ymode_probB[4][1]; |
| 735 |
unsigned char sb_ymode_prob[4][8]; |
| 736 |
|
| 737 |
/* address 37 */ |
| 738 |
unsigned char partition_prob[2][16][4]; |
| 739 |
|
| 740 |
/* address 41 */ |
| 741 |
unsigned char uv_mode_probB[10][1]; |
| 742 |
unsigned char switchable_interp_prob[4][2]; |
| 743 |
unsigned char comp_inter_prob[5]; |
| 744 |
unsigned char mbskip_probs[3]; |
| 745 |
NVDEC_VP9HWPAD(pad1, 1); |
| 746 |
|
| 747 |
nvdec_nmv_context nmvc; |
| 748 |
|
| 749 |
/* address 44 */ |
| 750 |
unsigned char single_ref_prob[5][2]; |
| 751 |
unsigned char comp_ref_prob[5]; |
| 752 |
NVDEC_VP9HWPAD(pad2, 17); |
| 753 |
|
| 754 |
/* address 45 */ |
| 755 |
unsigned char probCoeffs[2][2][6][6][4]; |
| 756 |
unsigned char probCoeffs8x8[2][2][6][6][4]; |
| 757 |
unsigned char probCoeffs16x16[2][2][6][6][4]; |
| 758 |
unsigned char probCoeffs32x32[2][2][6][6][4]; |
| 759 |
|
| 760 |
} nvdec_vp9AdaptiveEntropyProbs_t; |
| 761 |
|
| 762 |
/* Entropy contexts */ |
| 763 |
typedef struct nvdec_vp9EntropyProbs_s |
| 764 |
{ |
| 765 |
/* Default keyframe probs */ |
| 766 |
/* Table formatted for 256b memory, probs 0to7 for all tables followed by |
| 767 |
* probs 8toN for all tables. |
| 768 |
* Compile with TRACE_PROB_TABLES to print bases for each table. */ |
| 769 |
|
| 770 |
unsigned char kf_bmode_prob[10][10][8]; |
| 771 |
|
| 772 |
/* Address 25 */ |
| 773 |
unsigned char kf_bmode_probB[10][10][1]; |
| 774 |
unsigned char ref_pred_probs[3]; |
| 775 |
unsigned char mb_segment_tree_probs[7]; |
| 776 |
unsigned char segment_pred_probs[3]; |
| 777 |
unsigned char ref_scores[4]; |
| 778 |
unsigned char prob_comppred[2]; |
| 779 |
NVDEC_VP9HWPAD(pad1, 9); |
| 780 |
|
| 781 |
/* Address 29 */ |
| 782 |
unsigned char kf_uv_mode_prob[10][8]; |
| 783 |
unsigned char kf_uv_mode_probB[10][1]; |
| 784 |
NVDEC_VP9HWPAD(pad2, 6); |
| 785 |
|
| 786 |
nvdec_vp9AdaptiveEntropyProbs_t a; /* Probs with backward adaptation */ |
| 787 |
|
| 788 |
} nvdec_vp9EntropyProbs_t; |
| 789 |
|
| 790 |
/* Counters for adaptive entropy contexts */ |
| 791 |
typedef struct nvdec_vp9EntropyCounts_s |
| 792 |
{ |
| 793 |
unsigned int inter_mode_counts[7][3][2]; |
| 794 |
unsigned int sb_ymode_counts[4][10]; |
| 795 |
unsigned int uv_mode_counts[10][10]; |
| 796 |
unsigned int partition_counts[16][4]; |
| 797 |
unsigned int switchable_interp_counts[4][3]; |
| 798 |
unsigned int intra_inter_count[4][2]; |
| 799 |
unsigned int comp_inter_count[5][2]; |
| 800 |
unsigned int single_ref_count[5][2][2]; |
| 801 |
unsigned int comp_ref_count[5][2]; |
| 802 |
unsigned int tx32x32_count[2][4]; |
| 803 |
unsigned int tx16x16_count[2][3]; |
| 804 |
unsigned int tx8x8_count[2][2]; |
| 805 |
unsigned int mbskip_count[3][2]; |
| 806 |
|
| 807 |
nvdec_nmv_context_counts nmvcount; |
| 808 |
|
| 809 |
unsigned int countCoeffs[2][2][6][6][4]; |
| 810 |
unsigned int countCoeffs8x8[2][2][6][6][4]; |
| 811 |
unsigned int countCoeffs16x16[2][2][6][6][4]; |
| 812 |
unsigned int countCoeffs32x32[2][2][6][6][4]; |
| 813 |
|
| 814 |
unsigned int countEobs[4][2][2][6][6]; |
| 815 |
|
| 816 |
} nvdec_vp9EntropyCounts_t; |
| 817 |
|
| 818 |
// Legacy codecs encryption parameters |
| 819 |
typedef struct _nvdec_pass2_otf_s { |
| 820 |
unsigned int wrapped_session_key[4]; // session keys |
| 821 |
unsigned int wrapped_content_key[4]; // content keys |
| 822 |
unsigned int initialization_vector[4];// Ctrl64 initial vector |
| 823 |
unsigned int enable_encryption : 1; // flag to enable/disable encryption |
| 824 |
unsigned int key_increment : 6; // added to content key after unwrapping |
| 825 |
unsigned int encryption_mode : 4; |
| 826 |
unsigned int key_slot_index : 4; |
| 827 |
unsigned int ssm_en : 1; |
| 828 |
unsigned int reserved1 :16; // reserved |
| 829 |
} nvdec_pass2_otf_s; // 0x10 bytes |
| 830 |
|
| 831 |
typedef struct _nvdec_display_param_s |
| 832 |
{ |
| 833 |
unsigned int enableTFOutput : 1; //=1, enable dbfdma to output the display surface; if disable, then the following configure on tf is useless. |
| 834 |
//remap for VC1 |
| 835 |
unsigned int VC1MapYFlag : 1; |
| 836 |
unsigned int MapYValue : 3; |
| 837 |
unsigned int VC1MapUVFlag : 1; |
| 838 |
unsigned int MapUVValue : 3; |
| 839 |
//tf |
| 840 |
unsigned int OutStride : 8; |
| 841 |
unsigned int TilingFormat : 3; |
| 842 |
unsigned int OutputStructure : 1; //(0=frame, 1=field) |
| 843 |
unsigned int reserved0 :11; |
| 844 |
int OutputTop[2]; // in units of 256 |
| 845 |
int OutputBottom[2]; // in units of 256 |
| 846 |
//histogram |
| 847 |
unsigned int enableHistogram : 1; // enable histogram info collection. |
| 848 |
unsigned int HistogramStartX :12; // start X of Histogram window |
| 849 |
unsigned int HistogramStartY :12; // start Y of Histogram window |
| 850 |
unsigned int reserved1 : 7; |
| 851 |
unsigned int HistogramEndX :12; // end X of Histogram window |
| 852 |
unsigned int HistogramEndY :12; // end y of Histogram window |
| 853 |
unsigned int reserved2 : 8; |
| 854 |
} nvdec_display_param_s; // size 0x1c bytes |
| 855 |
|
| 856 |
// H.264 |
| 857 |
typedef struct _nvdec_dpb_entry_s // 16 bytes |
| 858 |
{ |
| 859 |
unsigned int index : 7; // uncompressed frame buffer index |
| 860 |
unsigned int col_idx : 5; // index of associated co-located motion data buffer |
| 861 |
unsigned int state : 2; // bit1(state)=1: top field used for reference, bit1(state)=1: bottom field used for reference |
| 862 |
unsigned int is_long_term : 1; // 0=short-term, 1=long-term |
| 863 |
unsigned int not_existing : 1; // 1=marked as non-existing |
| 864 |
unsigned int is_field : 1; // set if unpaired field or complementary field pair |
| 865 |
unsigned int top_field_marking : 4; |
| 866 |
unsigned int bottom_field_marking : 4; |
| 867 |
unsigned int output_memory_layout : 1; // Set according to picture level output NV12/NV24 setting. |
| 868 |
unsigned int reserved : 6; |
| 869 |
unsigned int FieldOrderCnt[2]; // : 2*32 [top/bottom] |
| 870 |
int FrameIdx; // : 16 short-term: FrameNum (16 bits), long-term: LongTermFrameIdx (4 bits) |
| 871 |
} nvdec_dpb_entry_s; |
| 872 |
|
| 873 |
typedef struct _nvdec_h264_pic_s |
| 874 |
{ |
| 875 |
nvdec_pass2_otf_s encryption_params; |
| 876 |
unsigned char eos[16]; |
| 877 |
unsigned char explicitEOSPresentFlag; |
| 878 |
unsigned char hint_dump_en; //enable COLOMV surface dump for all frames, which includes hints of "MV/REFIDX/QP/CBP/MBPART/MBTYPE", nvbug: 200212874 |
| 879 |
unsigned char reserved0[2]; |
| 880 |
unsigned int stream_len; |
| 881 |
unsigned int slice_count; |
| 882 |
unsigned int mbhist_buffer_size; // to pass buffer size of MBHIST_BUFFER |
| 883 |
|
| 884 |
// Driver may or may not use based upon need. |
| 885 |
// If 0 then default value of 1<<27 = 298ms @ 450MHz will be used in ucode. |
| 886 |
// Driver can send this value based upon resolution using the formula: |
| 887 |
// gptimer_timeout_value = 3 * (cycles required for one frame) |
| 888 |
unsigned int gptimer_timeout_value; |
| 889 |
|
| 890 |
// Fields from msvld_h264_seq_s |
| 891 |
int log2_max_pic_order_cnt_lsb_minus4; |
| 892 |
int delta_pic_order_always_zero_flag; |
| 893 |
int frame_mbs_only_flag; |
| 894 |
int PicWidthInMbs; |
| 895 |
int FrameHeightInMbs; |
| 896 |
|
| 897 |
unsigned int tileFormat : 2 ; // 0: TBL; 1: KBL; 2: Tile16x16 |
| 898 |
unsigned int gob_height : 3 ; // Set GOB height, 0: GOB_2, 1: GOB_4, 2: GOB_8, 3: GOB_16, 4: GOB_32 (NVDEC3 onwards) |
| 899 |
unsigned int reserverd_surface_format : 27; |
| 900 |
|
| 901 |
// Fields from msvld_h264_pic_s |
| 902 |
int entropy_coding_mode_flag; |
| 903 |
int pic_order_present_flag; |
| 904 |
int num_ref_idx_l0_active_minus1; |
| 905 |
int num_ref_idx_l1_active_minus1; |
| 906 |
int deblocking_filter_control_present_flag; |
| 907 |
int redundant_pic_cnt_present_flag; |
| 908 |
int transform_8x8_mode_flag; |
| 909 |
|
| 910 |
// Fields from mspdec_h264_picture_setup_s |
| 911 |
unsigned int pitch_luma; // Luma pitch |
| 912 |
unsigned int pitch_chroma; // chroma pitch |
| 913 |
|
| 914 |
unsigned int luma_top_offset; // offset of luma top field in units of 256 |
| 915 |
unsigned int luma_bot_offset; // offset of luma bottom field in units of 256 |
| 916 |
unsigned int luma_frame_offset; // offset of luma frame in units of 256 |
| 917 |
unsigned int chroma_top_offset; // offset of chroma top field in units of 256 |
| 918 |
unsigned int chroma_bot_offset; // offset of chroma bottom field in units of 256 |
| 919 |
unsigned int chroma_frame_offset; // offset of chroma frame in units of 256 |
| 920 |
unsigned int HistBufferSize; // in units of 256 |
| 921 |
|
| 922 |
unsigned int MbaffFrameFlag : 1; // |
| 923 |
unsigned int direct_8x8_inference_flag: 1; // |
| 924 |
unsigned int weighted_pred_flag : 1; // |
| 925 |
unsigned int constrained_intra_pred_flag:1; // |
| 926 |
unsigned int ref_pic_flag : 1; // reference picture (nal_ref_idc != 0) |
| 927 |
unsigned int field_pic_flag : 1; // |
| 928 |
unsigned int bottom_field_flag : 1; // |
| 929 |
unsigned int second_field : 1; // second field of complementary reference field |
| 930 |
unsigned int log2_max_frame_num_minus4: 4; // (0..12) |
| 931 |
unsigned int chroma_format_idc : 2; // |
| 932 |
unsigned int pic_order_cnt_type : 2; // (0..2) |
| 933 |
int pic_init_qp_minus26 : 6; // : 6 (-26..+25) |
| 934 |
int chroma_qp_index_offset : 5; // : 5 (-12..+12) |
| 935 |
int second_chroma_qp_index_offset : 5; // : 5 (-12..+12) |
| 936 |
|
| 937 |
unsigned int weighted_bipred_idc : 2; // : 2 (0..2) |
| 938 |
unsigned int CurrPicIdx : 7; // : 7 uncompressed frame buffer index |
| 939 |
unsigned int CurrColIdx : 5; // : 5 index of associated co-located motion data buffer |
| 940 |
unsigned int frame_num : 16; // |
| 941 |
unsigned int frame_surfaces : 1; // frame surfaces flag |
| 942 |
unsigned int output_memory_layout : 1; // 0: NV12; 1:NV24. Field pair must use the same setting. |
| 943 |
|
| 944 |
int CurrFieldOrderCnt[2]; // : 32 [Top_Bottom], [0]=TopFieldOrderCnt, [1]=BottomFieldOrderCnt |
| 945 |
nvdec_dpb_entry_s dpb[16]; |
| 946 |
unsigned char WeightScale[6][4][4]; // : 6*4*4*8 in raster scan order (not zig-zag order) |
| 947 |
unsigned char WeightScale8x8[2][8][8]; // : 2*8*8*8 in raster scan order (not zig-zag order) |
| 948 |
|
| 949 |
// mvc setup info, must be zero if not mvc |
| 950 |
unsigned char num_inter_view_refs_lX[2]; // number of inter-view references |
| 951 |
char reserved1[14]; // reserved for alignment |
| 952 |
signed char inter_view_refidx_lX[2][16]; // DPB indices (must also be marked as long-term) |
| 953 |
|
| 954 |
// lossless decode (At the time of writing this manual, x264 and JM encoders, differ in Intra_8x8 reference sample filtering) |
| 955 |
unsigned int lossless_ipred8x8_filter_enable : 1; // = 0, skips Intra_8x8 reference sample filtering, for vertical and horizontal predictions (x264 encoded streams); = 1, filter Intra_8x8 reference samples (JM encoded streams) |
| 956 |
unsigned int qpprime_y_zero_transform_bypass_flag : 1; // determines the transform bypass mode |
| 957 |
unsigned int reserved2 : 30; // kept for alignment; may be used for other parameters |
| 958 |
|
| 959 |
nvdec_display_param_s displayPara; |
| 960 |
nvdec_pass2_otf_ext_s ssm; |
| 961 |
|
| 962 |
} nvdec_h264_pic_s; |
| 963 |
|
| 964 |
// VC-1 Scratch buffer |
| 965 |
typedef enum _vc1_fcm_e |
| 966 |
{ |
| 967 |
FCM_PROGRESSIVE = 0, |
| 968 |
FCM_FRAME_INTERLACE = 2, |
| 969 |
FCM_FIELD_INTERLACE = 3 |
| 970 |
} vc1_fcm_e; |
| 971 |
|
| 972 |
typedef enum _syntax_vc1_ptype_e |
| 973 |
{ |
| 974 |
PTYPE_I = 0, |
| 975 |
PTYPE_P = 1, |
| 976 |
PTYPE_B = 2, |
| 977 |
PTYPE_BI = 3, //PTYPE_BI is not used to config register NV_CNVDEC_VLD_PIC_INFO_COMMON. field NV_CNVDEC_VLD_PIC_INFO_COMMON_PIC_CODING_VC1 is only 2 bits. I and BI pictures are configured with same value. Please refer to manual. |
| 978 |
PTYPE_SKIPPED = 4 |
| 979 |
} syntax_vc1_ptype_e; |
| 980 |
|
| 981 |
// 7.1.1.32, Table 46 etc. |
| 982 |
enum vc1_mvmode_e |
| 983 |
{ |
| 984 |
MVMODE_MIXEDMV = 0, |
| 985 |
MVMODE_1MV = 1, |
| 986 |
MVMODE_1MV_HALFPEL = 2, |
| 987 |
MVMODE_1MV_HALFPEL_BILINEAR = 3, |
| 988 |
MVMODE_INTENSITY_COMPENSATION = 4 |
| 989 |
}; |
| 990 |
|
| 991 |
// 9.1.1.42, Table 105 |
| 992 |
typedef enum _vc1_fptype_e |
| 993 |
{ |
| 994 |
FPTYPE_I_I = 0, |
| 995 |
FPTYPE_I_P, |
| 996 |
FPTYPE_P_I, |
| 997 |
FPTYPE_P_P, |
| 998 |
FPTYPE_B_B, |
| 999 |
FPTYPE_B_BI, |
| 1000 |
FPTYPE_BI_B, |
| 1001 |
FPTYPE_BI_BI |
| 1002 |
} vc1_fptype_e; |
| 1003 |
|
| 1004 |
// Table 43 (7.1.1.31.2) |
| 1005 |
typedef enum _vc1_dqprofile_e |
| 1006 |
{ |
| 1007 |
DQPROFILE_ALL_FOUR_EDGES = 0, |
| 1008 |
DQPROFILE_DOUBLE_EDGE = 1, |
| 1009 |
DQPROFILE_SINGLE_EDGE = 2, |
| 1010 |
DQPROFILE_ALL_MACROBLOCKS = 3 |
| 1011 |
} vc1_dqprofile_e; |
| 1012 |
|
| 1013 |
typedef struct _nvdec_vc1_pic_s |
| 1014 |
{ |
| 1015 |
nvdec_pass2_otf_s encryption_params; |
| 1016 |
unsigned char eos[16]; // to pass end of stream data separately if not present in bitstream surface |
| 1017 |
unsigned char prefixStartCode[4]; // used for dxva to pass prefix start code. |
| 1018 |
unsigned int bitstream_offset; // offset in words from start of bitstream surface if there is gap. |
| 1019 |
unsigned char explicitEOSPresentFlag; // to indicate that eos[] is used for passing end of stream data. |
| 1020 |
unsigned char reserved0[3]; |
| 1021 |
unsigned int stream_len; |
| 1022 |
unsigned int slice_count; |
| 1023 |
unsigned int scratch_pic_buffer_size; |
| 1024 |
|
| 1025 |
// Driver may or may not use based upon need. |
| 1026 |
// If 0 then default value of 1<<27 = 298ms @ 450MHz will be used in ucode. |
| 1027 |
// Driver can send this value based upon resolution using the formula: |
| 1028 |
// gptimer_timeout_value = 3 * (cycles required for one frame) |
| 1029 |
unsigned int gptimer_timeout_value; |
| 1030 |
|
| 1031 |
// Fields from vc1_seq_s |
| 1032 |
unsigned short FrameWidth; // actual frame width |
| 1033 |
unsigned short FrameHeight; // actual frame height |
| 1034 |
|
| 1035 |
unsigned char profile; // 1 = SIMPLE or MAIN, 2 = ADVANCED |
| 1036 |
unsigned char postprocflag; |
| 1037 |
unsigned char pulldown; |
| 1038 |
unsigned char interlace; |
| 1039 |
|
| 1040 |
unsigned char tfcntrflag; |
| 1041 |
unsigned char finterpflag; |
| 1042 |
unsigned char psf; |
| 1043 |
unsigned char tileFormat : 2 ; // 0: TBL; 1: KBL; 2: Tile16x16 |
| 1044 |
unsigned char gob_height : 3 ; // Set GOB height, 0: GOB_2, 1: GOB_4, 2: GOB_8, 3: GOB_16, 4: GOB_32 (NVDEC3 onwards) |
| 1045 |
unsigned char reserverd_surface_format : 3 ; |
| 1046 |
|
| 1047 |
// simple,main |
| 1048 |
unsigned char multires; |
| 1049 |
unsigned char syncmarker; |
| 1050 |
unsigned char rangered; |
| 1051 |
unsigned char maxbframes; |
| 1052 |
|
| 1053 |
// Fields from vc1_entrypoint_s |
| 1054 |
unsigned char dquant; |
| 1055 |
unsigned char panscan_flag; |
| 1056 |
unsigned char refdist_flag; |
| 1057 |
unsigned char quantizer; |
| 1058 |
|
| 1059 |
unsigned char extended_mv; |
| 1060 |
unsigned char extended_dmv; |
| 1061 |
unsigned char overlap; |
| 1062 |
unsigned char vstransform; |
| 1063 |
|
| 1064 |
// Fields from vc1_scratch_s |
| 1065 |
char refdist; |
| 1066 |
char reserved1[3]; // for alignment |
| 1067 |
|
| 1068 |
// Fields from vld_vc1_pic_s |
| 1069 |
vc1_fcm_e fcm; |
| 1070 |
syntax_vc1_ptype_e ptype; |
| 1071 |
int tfcntr; |
| 1072 |
int rptfrm; |
| 1073 |
int tff; |
| 1074 |
int rndctrl; |
| 1075 |
int pqindex; |
| 1076 |
int halfqp; |
| 1077 |
int pquantizer; |
| 1078 |
int postproc; |
| 1079 |
int condover; |
| 1080 |
int transacfrm; |
| 1081 |
int transacfrm2; |
| 1082 |
int transdctab; |
| 1083 |
int pqdiff; |
| 1084 |
int abspq; |
| 1085 |
int dquantfrm; |
| 1086 |
vc1_dqprofile_e dqprofile; |
| 1087 |
int dqsbedge; |
| 1088 |
int dqdbedge; |
| 1089 |
int dqbilevel; |
| 1090 |
int mvrange; |
| 1091 |
enum vc1_mvmode_e mvmode; |
| 1092 |
enum vc1_mvmode_e mvmode2; |
| 1093 |
int lumscale; |
| 1094 |
int lumshift; |
| 1095 |
int mvtab; |
| 1096 |
int cbptab; |
| 1097 |
int ttmbf; |
| 1098 |
int ttfrm; |
| 1099 |
int bfraction; |
| 1100 |
vc1_fptype_e fptype; |
| 1101 |
int numref; |
| 1102 |
int reffield; |
| 1103 |
int dmvrange; |
| 1104 |
int intcompfield; |
| 1105 |
int lumscale1; // type was char in ucode |
| 1106 |
int lumshift1; // type was char in ucode |
| 1107 |
int lumscale2; // type was char in ucode |
| 1108 |
int lumshift2; // type was char in ucode |
| 1109 |
int mbmodetab; |
| 1110 |
int imvtab; |
| 1111 |
int icbptab; |
| 1112 |
int fourmvbptab; |
| 1113 |
int fourmvswitch; |
| 1114 |
int intcomp; |
| 1115 |
int twomvbptab; |
| 1116 |
// simple,main |
| 1117 |
int rangeredfrm; |
| 1118 |
|
| 1119 |
// Fields from pdec_vc1_pic_s |
| 1120 |
unsigned int HistBufferSize; // in units of 256 |
| 1121 |
// frame buffers |
| 1122 |
unsigned int FrameStride[2]; // [y_c] |
| 1123 |
unsigned int luma_top_offset; // offset of luma top field in units of 256 |
| 1124 |
unsigned int luma_bot_offset; // offset of luma bottom field in units of 256 |
| 1125 |
unsigned int luma_frame_offset; // offset of luma frame in units of 256 |
| 1126 |
unsigned int chroma_top_offset; // offset of chroma top field in units of 256 |
| 1127 |
unsigned int chroma_bot_offset; // offset of chroma bottom field in units of 256 |
| 1128 |
unsigned int chroma_frame_offset; // offset of chroma frame in units of 256 |
| 1129 |
|
| 1130 |
unsigned short CodedWidth; // entrypoint specific |
| 1131 |
unsigned short CodedHeight; // entrypoint specific |
| 1132 |
|
| 1133 |
unsigned char loopfilter; // entrypoint specific |
| 1134 |
unsigned char fastuvmc; // entrypoint specific |
| 1135 |
unsigned char output_memory_layout; // picture specific |
| 1136 |
unsigned char ref_memory_layout[2]; // picture specific 0: fwd, 1: bwd |
| 1137 |
unsigned char reserved3[3]; // for alignment |
| 1138 |
|
| 1139 |
nvdec_display_param_s displayPara; |
| 1140 |
nvdec_pass2_otf_ext_s ssm; |
| 1141 |
|
| 1142 |
} nvdec_vc1_pic_s; |
| 1143 |
|
| 1144 |
// MPEG-2 |
| 1145 |
typedef struct _nvdec_mpeg2_pic_s |
| 1146 |
{ |
| 1147 |
nvdec_pass2_otf_s encryption_params; |
| 1148 |
unsigned char eos[16]; |
| 1149 |
unsigned char explicitEOSPresentFlag; |
| 1150 |
unsigned char reserved0[3]; |
| 1151 |
unsigned int stream_len; |
| 1152 |
unsigned int slice_count; |
| 1153 |
|
| 1154 |
// Driver may or may not use based upon need. |
| 1155 |
// If 0 then default value of 1<<27 = 298ms @ 450MHz will be used in ucode. |
| 1156 |
// Driver can send this value based upon resolution using the formula: |
| 1157 |
// gptimer_timeout_value = 3 * (cycles required for one frame) |
| 1158 |
unsigned int gptimer_timeout_value; |
| 1159 |
|
| 1160 |
// Fields from vld_mpeg2_seq_pic_info_s |
| 1161 |
short FrameWidth; // actual frame width |
| 1162 |
short FrameHeight; // actual frame height |
| 1163 |
unsigned char picture_structure; // 0 => Reserved, 1 => Top field, 2 => Bottom field, 3 => Frame picture. Table 6-14. |
| 1164 |
unsigned char picture_coding_type; // 0 => Forbidden, 1 => I, 2 => P, 3 => B, 4 => D (for MPEG-2). Table 6-12. |
| 1165 |
unsigned char intra_dc_precision; // 0 => 8 bits, 1=> 9 bits, 2 => 10 bits, 3 => 11 bits. Table 6-13. |
| 1166 |
char frame_pred_frame_dct; // as in section 6.3.10 |
| 1167 |
char concealment_motion_vectors; // as in section 6.3.10 |
| 1168 |
char intra_vlc_format; // as in section 6.3.10 |
| 1169 |
unsigned char tileFormat : 2 ; // 0: TBL; 1: KBL; 2: Tile16x16 |
| 1170 |
unsigned char gob_height : 3 ; // Set GOB height, 0: GOB_2, 1: GOB_4, 2: GOB_8, 3: GOB_16, 4: GOB_32 (NVDEC3 onwards) |
| 1171 |
unsigned char reserverd_surface_format : 3 ; |
| 1172 |
|
| 1173 |
char reserved1; // always 0 |
| 1174 |
char f_code[4]; // as in section 6.3.10 |
| 1175 |
|
| 1176 |
// Fields from pdec_mpeg2_picture_setup_s |
| 1177 |
unsigned short PicWidthInMbs; |
| 1178 |
unsigned short FrameHeightInMbs; |
| 1179 |
unsigned int pitch_luma; |
| 1180 |
unsigned int pitch_chroma; |
| 1181 |
unsigned int luma_top_offset; |
| 1182 |
unsigned int luma_bot_offset; |
| 1183 |
unsigned int luma_frame_offset; |
| 1184 |
unsigned int chroma_top_offset; |
| 1185 |
unsigned int chroma_bot_offset; |
| 1186 |
unsigned int chroma_frame_offset; |
| 1187 |
unsigned int HistBufferSize; |
| 1188 |
unsigned short output_memory_layout; |
| 1189 |
unsigned short alternate_scan; |
| 1190 |
unsigned short secondfield; |
| 1191 |
/******************************/ |
| 1192 |
// Got rid of the union kept for compatibility with NVDEC1. |
| 1193 |
// Removed field mpeg2, and kept rounding type. |
| 1194 |
// NVDEC1 ucode is not using the mpeg2 field, instead using codec type from the methods. |
| 1195 |
// Rounding type should only be set for Divx3.11. |
| 1196 |
unsigned short rounding_type; |
| 1197 |
/******************************/ |
| 1198 |
unsigned int MbInfoSizeInBytes; |
| 1199 |
unsigned int q_scale_type; |
| 1200 |
unsigned int top_field_first; |
| 1201 |
unsigned int full_pel_fwd_vector; |
| 1202 |
unsigned int full_pel_bwd_vector; |
| 1203 |
unsigned char quant_mat_8x8intra[64]; |
| 1204 |
unsigned char quant_mat_8x8nonintra[64]; |
| 1205 |
unsigned int ref_memory_layout[2]; //0:for fwd; 1:for bwd |
| 1206 |
|
| 1207 |
nvdec_display_param_s displayPara; |
| 1208 |
nvdec_pass2_otf_ext_s ssm; |
| 1209 |
|
| 1210 |
} nvdec_mpeg2_pic_s; |
| 1211 |
|
| 1212 |
// MPEG-4 |
| 1213 |
typedef struct _nvdec_mpeg4_pic_s |
| 1214 |
{ |
| 1215 |
nvdec_pass2_otf_s encryption_params; |
| 1216 |
unsigned char eos[16]; |
| 1217 |
unsigned char explicitEOSPresentFlag; |
| 1218 |
unsigned char reserved2[3]; // for alignment |
| 1219 |
unsigned int stream_len; |
| 1220 |
unsigned int slice_count; |
| 1221 |
unsigned int scratch_pic_buffer_size; |
| 1222 |
|
| 1223 |
// Driver may or may not use based upon need. |
| 1224 |
// If 0 then default value of 1<<27 = 298ms @ 450MHz will be used in ucode. |
| 1225 |
// Driver can send this value based upon resolution using the formula: |
| 1226 |
// gptimer_timeout_value = 3 * (cycles required for one frame) |
| 1227 |
unsigned int gptimer_timeout_value; |
| 1228 |
|
| 1229 |
// Fields from vld_mpeg4_seq_s |
| 1230 |
short FrameWidth; // :13 video_object_layer_width |
| 1231 |
short FrameHeight; // :13 video_object_layer_height |
| 1232 |
char vop_time_increment_bitcount; // : 5 1..16 |
| 1233 |
char resync_marker_disable; // : 1 |
| 1234 |
unsigned char tileFormat : 2 ; // 0: TBL; 1: KBL; 2: Tile16x16 |
| 1235 |
unsigned char gob_height : 3 ; // Set GOB height, 0: GOB_2, 1: GOB_4, 2: GOB_8, 3: GOB_16, 4: GOB_32 (NVDEC3 onwards) |
| 1236 |
unsigned char reserverd_surface_format : 3 ; |
| 1237 |
char reserved3; // for alignment |
| 1238 |
|
| 1239 |
// Fields from pdec_mpeg4_picture_setup_s |
| 1240 |
int width; // : 13 |
| 1241 |
int height; // : 13 |
| 1242 |
|
| 1243 |
unsigned int FrameStride[2]; // [y_c] |
| 1244 |
unsigned int luma_top_offset; // offset of luma top field in units of 256 |
| 1245 |
unsigned int luma_bot_offset; // offset of luma bottom field in units of 256 |
| 1246 |
unsigned int luma_frame_offset; // offset of luma frame in units of 256 |
| 1247 |
unsigned int chroma_top_offset; // offset of chroma top field in units of 256 |
| 1248 |
unsigned int chroma_bot_offset; // offset of chroma bottom field in units of 256 |
| 1249 |
unsigned int chroma_frame_offset; // offset of chroma frame in units of 256 |
| 1250 |
|
| 1251 |
unsigned int HistBufferSize; // in units of 256, History buffer size |
| 1252 |
|
| 1253 |
int trd[2]; // : 16, temporal reference frame distance (only needed for B-VOPs) |
| 1254 |
int trb[2]; // : 16, temporal reference B-VOP distance from fwd reference frame (only needed for B-VOPs) |
| 1255 |
|
| 1256 |
int divx_flags; // : 16 (bit 0: DivX interlaced chroma rounding, bit 1: Divx 4 boundary padding, bit 2: Divx IDCT) |
| 1257 |
|
| 1258 |
short vop_fcode_forward; // : 1...7 |
| 1259 |
short vop_fcode_backward; // : 1...7 |
| 1260 |
|
| 1261 |
unsigned char interlaced; // : 1 |
| 1262 |
unsigned char quant_type; // : 1 |
| 1263 |
unsigned char quarter_sample; // : 1 |
| 1264 |
unsigned char short_video_header; // : 1 |
| 1265 |
|
| 1266 |
unsigned char curr_output_memory_layout; // : 1 0:NV12; 1:NV24 |
| 1267 |
unsigned char ptype; // picture type: 0 for PTYPE_I, 1 for PTYPE_P, 2 for PTYPE_B, 3 for PTYPE_BI, 4 for PTYPE_SKIPPED |
| 1268 |
unsigned char rnd; // : 1, rounding mode |
| 1269 |
unsigned char alternate_vertical_scan_flag; // : 1 |
| 1270 |
|
| 1271 |
unsigned char top_field_flag; // : 1 |
| 1272 |
unsigned char reserved0[3]; // alignment purpose |
| 1273 |
|
| 1274 |
unsigned char intra_quant_mat[64]; // : 64*8 |
| 1275 |
unsigned char nonintra_quant_mat[64]; // : 64*8 |
| 1276 |
unsigned char ref_memory_layout[2]; //0:for fwd; 1:for bwd |
| 1277 |
unsigned char reserved1[34]; // 256 byte alignemnt till now |
| 1278 |
|
| 1279 |
nvdec_display_param_s displayPara; |
| 1280 |
|
| 1281 |
} nvdec_mpeg4_pic_s; |
| 1282 |
|
| 1283 |
// VP8 |
| 1284 |
enum VP8_FRAME_TYPE |
| 1285 |
{ |
| 1286 |
VP8_KEYFRAME = 0, |
| 1287 |
VP8_INTERFRAME = 1 |
| 1288 |
}; |
| 1289 |
|
| 1290 |
enum VP8_FRAME_SFC_ID |
| 1291 |
{ |
| 1292 |
VP8_GOLDEN_FRAME_SFC = 0, |
| 1293 |
VP8_ALTREF_FRAME_SFC, |
| 1294 |
VP8_LAST_FRAME_SFC, |
| 1295 |
VP8_CURR_FRAME_SFC |
| 1296 |
}; |
| 1297 |
|
| 1298 |
typedef struct _nvdec_vp8_pic_s |
| 1299 |
{ |
| 1300 |
nvdec_pass2_otf_s encryption_params; |
| 1301 |
|
| 1302 |
// Driver may or may not use based upon need. |
| 1303 |
// If 0 then default value of 1<<27 = 298ms @ 450MHz will be used in ucode. |
| 1304 |
// Driver can send this value based upon resolution using the formula: |
| 1305 |
// gptimer_timeout_value = 3 * (cycles required for one frame) |
| 1306 |
unsigned int gptimer_timeout_value; |
| 1307 |
|
| 1308 |
unsigned short FrameWidth; // actual frame width |
| 1309 |
unsigned short FrameHeight; // actual frame height |
| 1310 |
|
| 1311 |
unsigned char keyFrame; // 1: key frame; 0: not |
| 1312 |
unsigned char version; |
| 1313 |
unsigned char tileFormat : 2 ; // 0: TBL; 1: KBL; 2: Tile16x16 |
| 1314 |
unsigned char gob_height : 3 ; // Set GOB height, 0: GOB_2, 1: GOB_4, 2: GOB_8, 3: GOB_16, 4: GOB_32 (NVDEC3 onwards) |
| 1315 |
unsigned char reserverd_surface_format : 3 ; |
| 1316 |
unsigned char errorConcealOn; // 1: error conceal on; 0: off |
| 1317 |
|
| 1318 |
unsigned int firstPartSize; // the size of first partition(frame header and mb header partition) |
| 1319 |
|
| 1320 |
// ctx |
| 1321 |
unsigned int HistBufferSize; // in units of 256 |
| 1322 |
unsigned int VLDBufferSize; // in units of 1 |
| 1323 |
// current frame buffers |
| 1324 |
unsigned int FrameStride[2]; // [y_c] |
| 1325 |
unsigned int luma_top_offset; // offset of luma top field in units of 256 |
| 1326 |
unsigned int luma_bot_offset; // offset of luma bottom field in units of 256 |
| 1327 |
unsigned int luma_frame_offset; // offset of luma frame in units of 256 |
| 1328 |
unsigned int chroma_top_offset; // offset of chroma top field in units of 256 |
| 1329 |
unsigned int chroma_bot_offset; // offset of chroma bottom field in units of 256 |
| 1330 |
unsigned int chroma_frame_offset; // offset of chroma frame in units of 256 |
| 1331 |
|
| 1332 |
nvdec_display_param_s displayPara; |
| 1333 |
|
| 1334 |
// decode picture buffere related |
| 1335 |
char current_output_memory_layout; |
| 1336 |
char output_memory_layout[3]; // output NV12/NV24 setting. item 0:golden; 1: altref; 2: last |
| 1337 |
|
| 1338 |
unsigned char segmentation_feature_data_update; |
| 1339 |
unsigned char reserved1[3]; |
| 1340 |
|
| 1341 |
// ucode return result |
| 1342 |
unsigned int resultValue; // ucode return the picture header info; includes copy_buffer_to_golden etc. |
| 1343 |
unsigned int partition_offset[8]; // byte offset to each token partition (used for encrypted streams only) |
| 1344 |
|
| 1345 |
nvdec_pass2_otf_ext_s ssm; |
| 1346 |
|
| 1347 |
} nvdec_vp8_pic_s; // size is 0xc0 |
| 1348 |
|
| 1349 |
// PASS1 |
| 1350 |
|
| 1351 |
//Sample means the entire frame is encrypted with a single IV, and subsample means a given frame may be encrypted in multiple chunks with different IVs. |
| 1352 |
#define NUM_SUBSAMPLES 32 |
| 1353 |
|
| 1354 |
typedef struct _bytes_of_data_s |
| 1355 |
{ |
| 1356 |
unsigned int clear_bytes; // clear bytes per subsample |
| 1357 |
unsigned int encypted_bytes; // encrypted bytes per subsample |
| 1358 |
|
| 1359 |
} bytes_of_data_s; |
| 1360 |
|
| 1361 |
typedef struct _nvdec_pass1_input_data_s |
| 1362 |
{ |
| 1363 |
bytes_of_data_s sample_size[NUM_SUBSAMPLES]; // clear/encrypted bytes per subsample |
| 1364 |
unsigned int initialization_vector[NUM_SUBSAMPLES][4]; // Ctrl64 initial vector per subsample |
| 1365 |
unsigned char IvValid[NUM_SUBSAMPLES]; // each element will tell whether IV is valid for that subsample or not. |
| 1366 |
unsigned int stream_len; // encrypted bitstream size. |
| 1367 |
unsigned int clearBufferSize; // allocated size of clear buffer size |
| 1368 |
unsigned int reencryptBufferSize; // allocated size of reencrypted buffer size |
| 1369 |
unsigned int vp8coeffPartitonBufferSize; // allocated buffer for vp8 coeff partition buffer |
| 1370 |
unsigned int PrevWidth; // required for VP9 |
| 1371 |
unsigned int num_nals :16; // number of subsamples in a frame |
| 1372 |
unsigned int drm_mode : 8; // DRM mode |
| 1373 |
unsigned int key_sel : 4; // key select from keyslot |
| 1374 |
unsigned int codec : 4; // codecs selection |
| 1375 |
unsigned int TotalSizeOfClearData; // Used with Pattern based encryption |
| 1376 |
unsigned int SliceHdrOffset; // This is used with pattern mode encryption where data before slice hdr comes in clear. |
| 1377 |
unsigned int EncryptBlkCnt :16; |
| 1378 |
unsigned int SkipBlkCnt :16; |
| 1379 |
} nvdec_pass1_input_data_s; |
| 1380 |
|
| 1381 |
#define VP8_MAX_TOKEN_PARTITIONS 8 |
| 1382 |
#define VP9_MAX_FRAMES_IN_SUPERFRAME 8 |
| 1383 |
|
| 1384 |
typedef struct _nvdec_pass1_output_data_s |
| 1385 |
{ |
| 1386 |
unsigned int clear_header_size; // h264/vc1/mpeg2/vp8, decrypted pps/sps/part of slice header info, 128 bits aligned |
| 1387 |
unsigned int reencrypt_data_size; // h264/vc1/mpeg2, slice level data, vp8 mb header info, 128 bits aligned |
| 1388 |
unsigned int clear_token_data_size; // vp8, clear token data saved in VPR, 128 bits aligned |
| 1389 |
unsigned int key_increment : 6; // added to content key after unwrapping |
| 1390 |
unsigned int encryption_mode : 4; // encryption mode |
| 1391 |
unsigned int bReEncrypted : 1; // set to 0 if no re-encryption is done. |
| 1392 |
unsigned int bvp9SuperFrame : 1; // set to 1 for vp9 superframe |
| 1393 |
unsigned int vp9NumFramesMinus1 : 3; // set equal to numFrames-1 for vp9superframe. Max 8 frames are possible in vp9 superframe. |
| 1394 |
unsigned int reserved1 :17; // reserved, 32 bit alignment |
| 1395 |
unsigned int wrapped_session_key[4]; // session keys |
| 1396 |
unsigned int wrapped_content_key[4]; // content keys |
| 1397 |
unsigned int initialization_vector[4]; // Ctrl64 initial vector |
| 1398 |
union { |
| 1399 |
unsigned int partition_size[VP8_MAX_TOKEN_PARTITIONS]; // size of each token partition (used for encrypted streams of VP8) |
| 1400 |
unsigned int vp9_frame_sizes[VP9_MAX_FRAMES_IN_SUPERFRAME]; // frame size information for all frames in vp9 superframe. |
| 1401 |
}; |
| 1402 |
unsigned int vp9_clear_hdr_size[VP9_MAX_FRAMES_IN_SUPERFRAME]; // clear header size for each frame in vp9 superframe. |
| 1403 |
} nvdec_pass1_output_data_s; |
| 1404 |
|
| 1405 |
|
| 1406 |
/***************************************************** |
| 1407 |
AV1 |
| 1408 |
*****************************************************/ |
| 1409 |
typedef struct _scale_factors_reference_s{ |
| 1410 |
short x_scale_fp; // horizontal fixed point scale factor |
| 1411 |
short y_scale_fp; // vertical fixed point scale factor |
| 1412 |
}scale_factors_reference_s; |
| 1413 |
|
| 1414 |
typedef struct _frame_info_t{ |
| 1415 |
unsigned short width; // in pixel, av1 support arbitray resolution |
| 1416 |
unsigned short height; |
| 1417 |
unsigned short stride[2]; // luma and chroma stride in 16Bytes |
| 1418 |
unsigned int frame_buffer_idx; // TBD :clean associate the reference frame and frame buffer id to lookup base_addr |
| 1419 |
} frame_info_t; |
| 1420 |
|
| 1421 |
typedef struct _ref_frame_struct_s{ |
| 1422 |
frame_info_t info; |
| 1423 |
scale_factors_reference_s sf; // scalefactor for reference frame and current frame size, driver can calculate it |
| 1424 |
unsigned char sign_bias : 1; // calcuate based on frame_offset and current frame offset |
| 1425 |
unsigned char wmtype : 2; // global motion parameters : identity,translation,rotzoom,affine |
| 1426 |
unsigned char reserved_rf : 5; |
| 1427 |
short frame_off; // relative offset to current frame |
| 1428 |
short roffset; // relative offset from current frame |
| 1429 |
} ref_frame_struct_s; |
| 1430 |
|
| 1431 |
typedef struct _av1_fgs_cfg_t{ |
| 1432 |
//from AV1 spec 5.9.30 Film Grain Params syntax |
| 1433 |
unsigned short apply_grain : 1; |
| 1434 |
unsigned short overlap_flag : 1; |
| 1435 |
unsigned short clip_to_restricted_range : 1; |
| 1436 |
unsigned short chroma_scaling_from_luma : 1; |
| 1437 |
unsigned short num_y_points_b : 1; // flag indicates num_y_points>0 |
| 1438 |
unsigned short num_cb_points_b : 1; // flag indicates num_cb_points>0 |
| 1439 |
unsigned short num_cr_points_b : 1; // flag indicates num_cr_points>0 |
| 1440 |
unsigned short scaling_shift : 4; |
| 1441 |
unsigned short reserved_fgs : 5; |
| 1442 |
unsigned short sw_random_seed; |
| 1443 |
short cb_offset; |
| 1444 |
short cr_offset; |
| 1445 |
char cb_mult; |
| 1446 |
char cb_luma_mult; |
| 1447 |
char cr_mult; |
| 1448 |
char cr_luma_mult; |
| 1449 |
} av1_fgs_cfg_t; |
| 1450 |
|
| 1451 |
|
| 1452 |
typedef struct _nvdec_av1_pic_s |
| 1453 |
{ |
| 1454 |
nvdec_pass2_otf_s encryption_params; |
| 1455 |
|
| 1456 |
nvdec_pass2_otf_ext_s ssm; |
| 1457 |
|
| 1458 |
av1_fgs_cfg_t fgs_cfg; |
| 1459 |
|
| 1460 |
// Driver may or may not use based upon need. |
| 1461 |
// If 0 then default value of 1<<27 = 298ms @ 450MHz will be used in ucode. |
| 1462 |
// Driver can send this value based upon resolution using the formula: |
| 1463 |
// gptimer_timeout_value = 3 * (cycles required for one frame) |
| 1464 |
unsigned int gptimer_timeout_value; |
| 1465 |
|
| 1466 |
unsigned int stream_len; // stream length. |
| 1467 |
unsigned int reserved12; // skip bytes length to real frame data . |
| 1468 |
|
| 1469 |
//sequence header |
| 1470 |
unsigned int use_128x128_superblock : 1; // superblock 128x128 or 64x64, 0:64x64, 1: 128x128 |
| 1471 |
unsigned int chroma_format : 2; // 1:420, others:reserved for future |
| 1472 |
unsigned int bit_depth : 4; // bitdepth |
| 1473 |
unsigned int enable_filter_intra : 1; // tool enable in seq level, 0 : disable 1: frame header control |
| 1474 |
unsigned int enable_intra_edge_filter : 1; |
| 1475 |
unsigned int enable_interintra_compound : 1; |
| 1476 |
unsigned int enable_masked_compound : 1; |
| 1477 |
unsigned int enable_dual_filter : 1; // enable or disable vertical and horiz filter selection |
| 1478 |
unsigned int reserved10 : 1; // 0 - disable order hint, and related tools |
| 1479 |
unsigned int reserved0 : 3; |
| 1480 |
unsigned int enable_jnt_comp : 1; // 0 - disable joint compound modes |
| 1481 |
unsigned int reserved1 : 1; |
| 1482 |
unsigned int enable_cdef : 1; |
| 1483 |
unsigned int reserved11 : 1; |
| 1484 |
unsigned int enable_fgs : 1; |
| 1485 |
unsigned int enable_substream_decoding : 1; //enable frame substream kickoff mode without context switch |
| 1486 |
unsigned int reserved2 : 10; // reserved bits |
| 1487 |
|
| 1488 |
//frame header |
| 1489 |
unsigned int frame_type : 2; // 0:Key frame, 1:Inter frame, 2:intra only, 3:s-frame |
| 1490 |
unsigned int show_frame : 1; // show frame flag |
| 1491 |
unsigned int reserved13 : 1; |
| 1492 |
unsigned int disable_cdf_update : 1; // disable CDF update during symbol decoding |
| 1493 |
unsigned int allow_screen_content_tools : 1; // screen content tool enable |
| 1494 |
unsigned int cur_frame_force_integer_mv : 1; // AMVR enable |
| 1495 |
unsigned int scale_denom_minus9 : 3; // The denominator minus9 of the superres scale |
| 1496 |
unsigned int allow_intrabc : 1; // IBC enable |
| 1497 |
unsigned int allow_high_precision_mv : 1; // 1/8 precision mv enable |
| 1498 |
unsigned int interp_filter : 3; // interpolation filter : EIGHTTAP_REGULAR,.... |
| 1499 |
unsigned int switchable_motion_mode : 1; // 0: simple motion mode, 1: SIMPLE, OBMC, LOCAL WARP |
| 1500 |
unsigned int use_ref_frame_mvs : 1; // 1: current frame can use the previous frame mv information, MFMV |
| 1501 |
unsigned int refresh_frame_context : 1; // backward update flag |
| 1502 |
unsigned int delta_q_present_flag : 1; // quantizer index delta values are present in the block level |
| 1503 |
unsigned int delta_q_res : 2; // left shift will apply to decoded quantizer index delta values |
| 1504 |
unsigned int delta_lf_present_flag : 1; // specified whether loop filter delta values are present in the block level |
| 1505 |
unsigned int delta_lf_res : 2; // specifies the left shift will apply to decoded loop filter values |
| 1506 |
unsigned int delta_lf_multi : 1; // seperate loop filter deltas for Hy,Vy,U,V edges |
| 1507 |
unsigned int reserved3 : 1; |
| 1508 |
unsigned int coded_lossless : 1; // 1 means all segments use lossless coding. Frame is fully lossless, CDEF/DBF will disable |
| 1509 |
unsigned int tile_enabled : 1; // tile enable |
| 1510 |
unsigned int reserved4 : 2; |
| 1511 |
unsigned int superres_is_scaled : 1; // frame level frame for using_superres |
| 1512 |
unsigned int reserved_fh : 1; |
| 1513 |
|
| 1514 |
unsigned int tile_cols : 8; // horizontal tile numbers in frame, max is 64 |
| 1515 |
unsigned int tile_rows : 8; // vertical tile numbers in frame, max is 64 |
| 1516 |
unsigned int context_update_tile_id : 16; // which tile cdf will be seleted as the backward update CDF, MAXTILEROW=64, MAXTILECOL=64, 12bits |
| 1517 |
|
| 1518 |
unsigned int cdef_damping_minus_3 : 2; // controls the amount of damping in the deringing filter |
| 1519 |
unsigned int cdef_bits : 2; // the number of bits needed to specify which CDEF filter to apply |
| 1520 |
unsigned int frame_tx_mode : 3; // 0:ONLY4x4,3:LARGEST,4:SELECT |
| 1521 |
unsigned int frame_reference_mode : 2; // single,compound,select |
| 1522 |
unsigned int skip_mode_flag : 1; // skip mode |
| 1523 |
unsigned int skip_ref0 : 4; |
| 1524 |
unsigned int skip_ref1 : 4; |
| 1525 |
unsigned int allow_warp : 1; // sequence level & frame level warp enable |
| 1526 |
unsigned int reduced_tx_set_used : 1; // whether the frame is restricted to oa reduced subset of the full set of transform types |
| 1527 |
unsigned int ref_scaling_enable : 1; |
| 1528 |
unsigned int reserved5 : 1; |
| 1529 |
unsigned int reserved6 : 10; // reserved bits |
| 1530 |
unsigned short superres_upscaled_width; // upscale width, frame_size_with_refs() syntax,restoration will use it |
| 1531 |
unsigned short superres_luma_step; |
| 1532 |
unsigned short superres_chroma_step; |
| 1533 |
unsigned short superres_init_luma_subpel_x; |
| 1534 |
unsigned short superres_init_chroma_subpel_x; |
| 1535 |
|
| 1536 |
/*frame header qp information*/ |
| 1537 |
unsigned char base_qindex; // the maximum qp is 255 |
| 1538 |
char y_dc_delta_q; |
| 1539 |
char u_dc_delta_q; |
| 1540 |
char v_dc_delta_q; |
| 1541 |
char u_ac_delta_q; |
| 1542 |
char v_ac_delta_q; |
| 1543 |
unsigned char qm_y; // 4bit: 0-15 |
| 1544 |
unsigned char qm_u; |
| 1545 |
unsigned char qm_v; |
| 1546 |
|
| 1547 |
/*cdef, need to update in the new spec*/ |
| 1548 |
unsigned int cdef_y_pri_strength; // 4bit for one, max is 8 |
| 1549 |
unsigned int cdef_uv_pri_strength; // 4bit for one, max is 8 |
| 1550 |
unsigned int cdef_y_sec_strength : 16; // 2bit for one, max is 8 |
| 1551 |
unsigned int cdef_uv_sec_strength : 16; // 2bit for one, max is 8 |
| 1552 |
|
| 1553 |
/*segmentation*/ |
| 1554 |
unsigned char segment_enabled; |
| 1555 |
unsigned char segment_update_map; |
| 1556 |
unsigned char reserved7; |
| 1557 |
unsigned char segment_temporal_update; |
| 1558 |
short segment_feature_data[8][8]; |
| 1559 |
unsigned char last_active_segid; // The highest numbered segment id that has some enabled feature. |
| 1560 |
unsigned char segid_preskip; // Whether the segment id will be read before the skip syntax element. |
| 1561 |
// 1: the segment id will be read first. |
| 1562 |
// 0: the skip syntax element will be read first. |
| 1563 |
unsigned char prevsegid_flag; // 1 : previous segment id is available |
| 1564 |
unsigned char segment_quant_sign : 8; // sign bit for segment alternative QP |
| 1565 |
|
| 1566 |
/*loopfilter*/ |
| 1567 |
unsigned char filter_level[2]; |
| 1568 |
unsigned char filter_level_u; |
| 1569 |
unsigned char filter_level_v; |
| 1570 |
unsigned char lf_sharpness_level; |
| 1571 |
char lf_ref_deltas[8]; // 0 = Intra, Last, Last2+Last3, GF, BRF, ARF2, ARF |
| 1572 |
char lf_mode_deltas[2]; // 0 = ZERO_MV, MV |
| 1573 |
|
| 1574 |
/*restoration*/ |
| 1575 |
unsigned char lr_type ; // restoration type. Y:bit[1:0];U:bit[3:2],V:bit[5:4] |
| 1576 |
unsigned char lr_unit_size; // restoration unit size 0:32x32, 1:64x64, 2:128x128,3:256x256; Y:bit[1:0];U:bit[3:2],V:bit[5:4] |
| 1577 |
|
| 1578 |
//general |
| 1579 |
frame_info_t current_frame; |
| 1580 |
ref_frame_struct_s ref_frame[7]; // Last, Last2, Last3, Golden, BWDREF, ALTREF2, ALTREF |
| 1581 |
|
| 1582 |
unsigned int use_temporal0_mvs : 1; |
| 1583 |
unsigned int use_temporal1_mvs : 1; |
| 1584 |
unsigned int use_temporal2_mvs : 1; |
| 1585 |
unsigned int mf1_type : 3; |
| 1586 |
unsigned int mf2_type : 3; |
| 1587 |
unsigned int mf3_type : 3; |
| 1588 |
unsigned int reserved_mfmv : 20; |
| 1589 |
|
| 1590 |
short mfmv_offset[3][7]; // 3: mf0~2, 7: Last, Last2, Last3, Golden, BWDREF, ALTREF2, ALTREF |
| 1591 |
char mfmv_side[3][7]; // flag for reverse offset great than 0 |
| 1592 |
// MFMV relative offset from the ref frame(reference to reference relative offset) |
| 1593 |
|
| 1594 |
unsigned char tileformat : 2; // 0: TBL; 1: KBL; |
| 1595 |
unsigned char gob_height : 3; // Set GOB height, 0: GOB_2, 1: GOB_4, 2: GOB_8, 3: GOB_16, 4: GOB_32 (NVDEC3 onwards) |
| 1596 |
unsigned char errorConcealOn : 1; // this field is not used, use ctrl_param.error_conceal_on to enable error concealment in ucode, |
| 1597 |
// always set NV_CNVDEC_GIP_ERR_CONCEAL_CTRL_ON = 1 to enable error detect in hw |
| 1598 |
unsigned char reserver8 : 2; // reserve |
| 1599 |
|
| 1600 |
unsigned char stream_error_detection : 1; |
| 1601 |
unsigned char mv_error_detection : 1; |
| 1602 |
unsigned char coeff_error_detection : 1; |
| 1603 |
unsigned char reserved_eh : 5; |
| 1604 |
|
| 1605 |
// Filt neighbor buffer offset |
| 1606 |
unsigned int Av1FltTopOffset; // filter top buffer offset respect to filter buffer, 256 bytes unit |
| 1607 |
unsigned int Av1FltVertOffset; // filter vertical buffer offset respect to filter buffer, 256 bytes unit |
| 1608 |
unsigned int Av1CdefVertOffset; // cdef vertical buffer offset respect to filter buffer, 256 bytes unit |
| 1609 |
unsigned int Av1LrVertOffset; // lr vertical buffer offset respect to filter buffer, 256 bytes unit |
| 1610 |
unsigned int Av1HusVertOffset; // hus vertical buffer offset respect to filter buffer, 256 bytes unit |
| 1611 |
unsigned int Av1FgsVertOffset; // fgs vertical buffer offset respect to filter buffer, 256 bytes unit |
| 1612 |
|
| 1613 |
unsigned int enable_histogram : 1; |
| 1614 |
unsigned int sw_skip_start_length : 14; //skip start length |
| 1615 |
unsigned int reserved_stat : 17; |
| 1616 |
|
| 1617 |
} nvdec_av1_pic_s; |
| 1618 |
|
| 1619 |
////////////////////////////////////////////////////////////////////// |
| 1620 |
// AV1 Buffer structure |
| 1621 |
////////////////////////////////////////////////////////////////////// |
| 1622 |
typedef struct _AV1FilmGrainMemory |
| 1623 |
{ |
| 1624 |
unsigned char scaling_lut_y[256]; |
| 1625 |
unsigned char scaling_lut_cb[256]; |
| 1626 |
unsigned char scaling_lut_cr[256]; |
| 1627 |
short cropped_luma_grain_block[4096]; |
| 1628 |
short cropped_cb_grain_block[1024]; |
| 1629 |
short cropped_cr_grain_block[1024]; |
| 1630 |
} AV1FilmGrainMemory; |
| 1631 |
|
| 1632 |
typedef struct _AV1TileInfo_OLD |
| 1633 |
{ |
| 1634 |
unsigned char width_in_sb; |
| 1635 |
unsigned char height_in_sb; |
| 1636 |
unsigned char tile_start_b0; |
| 1637 |
unsigned char tile_start_b1; |
| 1638 |
unsigned char tile_start_b2; |
| 1639 |
unsigned char tile_start_b3; |
| 1640 |
unsigned char tile_end_b0; |
| 1641 |
unsigned char tile_end_b1; |
| 1642 |
unsigned char tile_end_b2; |
| 1643 |
unsigned char tile_end_b3; |
| 1644 |
unsigned char padding[6]; |
| 1645 |
} AV1TileInfo_OLD; |
| 1646 |
|
| 1647 |
typedef struct _AV1TileInfo |
| 1648 |
{ |
| 1649 |
unsigned char width_in_sb; |
| 1650 |
unsigned char padding_w; |
| 1651 |
unsigned char height_in_sb; |
| 1652 |
unsigned char padding_h; |
| 1653 |
} AV1TileInfo; |
| 1654 |
|
| 1655 |
typedef struct _AV1TileStreamInfo |
| 1656 |
{ |
| 1657 |
unsigned int tile_start; |
| 1658 |
unsigned int tile_end; |
| 1659 |
unsigned char padding[8]; |
| 1660 |
} AV1TileStreamInfo; |
| 1661 |
|
| 1662 |
|
| 1663 |
// AV1 TileSize buffer |
| 1664 |
#define AV1_MAX_TILES 256 |
| 1665 |
#define AV1_TILEINFO_BUF_SIZE_OLD NVDEC_ALIGN(AV1_MAX_TILES * sizeof(AV1TileInfo_OLD)) |
| 1666 |
#define AV1_TILEINFO_BUF_SIZE NVDEC_ALIGN(AV1_MAX_TILES * sizeof(AV1TileInfo)) |
| 1667 |
|
| 1668 |
// AV1 TileStreamInfo buffer |
| 1669 |
#define AV1_TILESTREAMINFO_BUF_SIZE NVDEC_ALIGN(AV1_MAX_TILES * sizeof(AV1TileStreamInfo)) |
| 1670 |
|
| 1671 |
// AV1 SubStreamEntry buffer |
| 1672 |
#define MAX_SUBSTREAM_ENTRY_SIZE 32 |
| 1673 |
#define AV1_SUBSTREAM_ENTRY_BUF_SIZE NVDEC_ALIGN(MAX_SUBSTREAM_ENTRY_SIZE * sizeof(nvdec_substream_entry_s)) |
| 1674 |
|
| 1675 |
// AV1 FilmGrain Parameter buffer |
| 1676 |
#define AV1_FGS_BUF_SIZE NVDEC_ALIGN(sizeof(AV1FilmGrainMemory)) |
| 1677 |
|
| 1678 |
// AV1 Temporal MV buffer |
| 1679 |
#define AV1_TEMPORAL_MV_SIZE_IN_64x64 256 // 4Bytes for 8x8 |
| 1680 |
#define AV1_TEMPORAL_MV_BUF_SIZE(w, h) ALIGN_UP( ALIGN_UP(w,128) * ALIGN_UP(h,128) / (64*64) * AV1_TEMPORAL_MV_SIZE_IN_64x64, 4096) |
| 1681 |
|
| 1682 |
// AV1 SegmentID buffer |
| 1683 |
#define AV1_SEGMENT_ID_SIZE_IN_64x64 128 // (3bits + 1 pad_bits) for 4x4 |
| 1684 |
#define AV1_SEGMENT_ID_BUF_SIZE(w, h) ALIGN_UP( ALIGN_UP(w,128) * ALIGN_UP(h,128) / (64*64) * AV1_SEGMENT_ID_SIZE_IN_64x64, 4096) |
| 1685 |
|
| 1686 |
// AV1 Global Motion buffer |
| 1687 |
#define AV1_GLOBAL_MOTION_BUF_SIZE NVDEC_ALIGN(7*32) |
| 1688 |
|
| 1689 |
// AV1 Intra Top buffer |
| 1690 |
#define AV1_INTRA_TOP_BUF_SIZE NVDEC_ALIGN(8*8192) |
| 1691 |
|
| 1692 |
// AV1 Histogram buffer |
| 1693 |
#define AV1_HISTOGRAM_BUF_SIZE NVDEC_ALIGN(1024) |
| 1694 |
|
| 1695 |
// AV1 Filter FG buffer |
| 1696 |
#define AV1_DBLK_TOP_SIZE_IN_SB64 ALIGN_UP(1920, 128) |
| 1697 |
#define AV1_DBLK_TOP_BUF_SIZE(w) NVDEC_ALIGN( (ALIGN_UP(w,64)/64 + 2) * AV1_DBLK_TOP_SIZE_IN_SB64) |
| 1698 |
|
| 1699 |
#define AV1_DBLK_LEFT_SIZE_IN_SB64 ALIGN_UP(1536, 128) |
| 1700 |
#define AV1_DBLK_LEFT_BUF_SIZE(h) NVDEC_ALIGN( (ALIGN_UP(h,64)/64 + 2) * AV1_DBLK_LEFT_SIZE_IN_SB64) |
| 1701 |
|
| 1702 |
#define AV1_CDEF_LEFT_SIZE_IN_SB64 ALIGN_UP(1792, 128) |
| 1703 |
#define AV1_CDEF_LEFT_BUF_SIZE(h) NVDEC_ALIGN( (ALIGN_UP(h,64)/64 + 2) * AV1_CDEF_LEFT_SIZE_IN_SB64) |
| 1704 |
|
| 1705 |
#define AV1_HUS_LEFT_SIZE_IN_SB64 ALIGN_UP(12544, 128) |
| 1706 |
#define AV1_ASIC_HUS_LEFT_BUFFER_SIZE(h) NVDEC_ALIGN( (ALIGN_UP(h,64)/64 + 2) * AV1_HUS_LEFT_SIZE_IN_SB64) |
| 1707 |
#define AV1_HUS_LEFT_BUF_SIZE(h) 2*AV1_ASIC_HUS_LEFT_BUFFER_SIZE(h) // Ping-Pong buffers |
| 1708 |
|
| 1709 |
#define AV1_LR_LEFT_SIZE_IN_SB64 ALIGN_UP(1920, 128) |
| 1710 |
#define AV1_LR_LEFT_BUF_SIZE(h) NVDEC_ALIGN( (ALIGN_UP(h,64)/64 + 2) * AV1_LR_LEFT_SIZE_IN_SB64) |
| 1711 |
|
| 1712 |
#define AV1_FGS_LEFT_SIZE_IN_SB64 ALIGN_UP(320, 128) |
| 1713 |
#define AV1_FGS_LEFT_BUF_SIZE(h) NVDEC_ALIGN( (ALIGN_UP(h,64)/64 + 2) * AV1_FGS_LEFT_SIZE_IN_SB64) |
| 1714 |
|
| 1715 |
// AV1 Hint Dump Buffer |
| 1716 |
#define AV1_HINT_DUMP_SIZE_IN_SB64 ((64*64)/(4*4)*8) // 8 bytes per CU, 256 CUs(2048 bytes) per SB64 |
| 1717 |
#define AV1_HINT_DUMP_SIZE_IN_SB128 ((128*128)/(4*4)*8) // 8 bytes per CU,1024 CUs(8192 bytes) per SB128 |
| 1718 |
#define AV1_HINT_DUMP_SIZE(w, h) NVDEC_ALIGN(AV1_HINT_DUMP_SIZE_IN_SB128*((w+127)/128)*((h+127)/128)) // always use SB128 for allocation |
| 1719 |
|
| 1720 |
|
| 1721 |
/******************************************************************* |
| 1722 |
New H264 |
| 1723 |
********************************************************************/ |
| 1724 |
typedef struct _nvdec_new_h264_pic_s |
| 1725 |
{ |
| 1726 |
nvdec_pass2_otf_s encryption_params; |
| 1727 |
unsigned char eos[16]; |
| 1728 |
unsigned char explicitEOSPresentFlag; |
| 1729 |
unsigned char hint_dump_en; //enable COLOMV surface dump for all frames, which includes hints of "MV/REFIDX/QP/CBP/MBPART/MBTYPE", nvbug: 200212874 |
| 1730 |
unsigned char reserved0[2]; |
| 1731 |
unsigned int stream_len; |
| 1732 |
unsigned int slice_count; |
| 1733 |
unsigned int mbhist_buffer_size; // to pass buffer size of MBHIST_BUFFER |
| 1734 |
|
| 1735 |
// Driver may or may not use based upon need. |
| 1736 |
// If 0 then default value of 1<<27 = 298ms @ 450MHz will be used in ucode. |
| 1737 |
// Driver can send this value based upon resolution using the formula: |
| 1738 |
// gptimer_timeout_value = 3 * (cycles required for one frame) |
| 1739 |
unsigned int gptimer_timeout_value; |
| 1740 |
|
| 1741 |
// Fields from msvld_h264_seq_s |
| 1742 |
int log2_max_pic_order_cnt_lsb_minus4; |
| 1743 |
int delta_pic_order_always_zero_flag; |
| 1744 |
int frame_mbs_only_flag; |
| 1745 |
int PicWidthInMbs; |
| 1746 |
int FrameHeightInMbs; |
| 1747 |
|
| 1748 |
unsigned int tileFormat : 2 ; // 0: TBL; 1: KBL; 2: Tile16x16 |
| 1749 |
unsigned int gob_height : 3 ; // Set GOB height, 0: GOB_2, 1: GOB_4, 2: GOB_8, 3: GOB_16, 4: GOB_32 (NVDEC3 onwards) |
| 1750 |
unsigned int reserverd_surface_format : 27; |
| 1751 |
|
| 1752 |
// Fields from msvld_h264_pic_s |
| 1753 |
int entropy_coding_mode_flag; |
| 1754 |
int pic_order_present_flag; |
| 1755 |
int num_ref_idx_l0_active_minus1; |
| 1756 |
int num_ref_idx_l1_active_minus1; |
| 1757 |
int deblocking_filter_control_present_flag; |
| 1758 |
int redundant_pic_cnt_present_flag; |
| 1759 |
int transform_8x8_mode_flag; |
| 1760 |
|
| 1761 |
// Fields from mspdec_h264_picture_setup_s |
| 1762 |
unsigned int pitch_luma; // Luma pitch |
| 1763 |
unsigned int pitch_chroma; // chroma pitch |
| 1764 |
|
| 1765 |
unsigned int luma_top_offset; // offset of luma top field in units of 256 |
| 1766 |
unsigned int luma_bot_offset; // offset of luma bottom field in units of 256 |
| 1767 |
unsigned int luma_frame_offset; // offset of luma frame in units of 256 |
| 1768 |
unsigned int chroma_top_offset; // offset of chroma top field in units of 256 |
| 1769 |
unsigned int chroma_bot_offset; // offset of chroma bottom field in units of 256 |
| 1770 |
unsigned int chroma_frame_offset; // offset of chroma frame in units of 256 |
| 1771 |
unsigned int HistBufferSize; // in units of 256 |
| 1772 |
|
| 1773 |
unsigned int MbaffFrameFlag : 1; // |
| 1774 |
unsigned int direct_8x8_inference_flag: 1; // |
| 1775 |
unsigned int weighted_pred_flag : 1; // |
| 1776 |
unsigned int constrained_intra_pred_flag:1; // |
| 1777 |
unsigned int ref_pic_flag : 1; // reference picture (nal_ref_idc != 0) |
| 1778 |
unsigned int field_pic_flag : 1; // |
| 1779 |
unsigned int bottom_field_flag : 1; // |
| 1780 |
unsigned int second_field : 1; // second field of complementary reference field |
| 1781 |
unsigned int log2_max_frame_num_minus4: 4; // (0..12) |
| 1782 |
unsigned int chroma_format_idc : 2; // |
| 1783 |
unsigned int pic_order_cnt_type : 2; // (0..2) |
| 1784 |
int pic_init_qp_minus26 : 6; // : 6 (-26..+25) |
| 1785 |
int chroma_qp_index_offset : 5; // : 5 (-12..+12) |
| 1786 |
int second_chroma_qp_index_offset : 5; // : 5 (-12..+12) |
| 1787 |
|
| 1788 |
unsigned int weighted_bipred_idc : 2; // : 2 (0..2) |
| 1789 |
unsigned int CurrPicIdx : 7; // : 7 uncompressed frame buffer index |
| 1790 |
unsigned int CurrColIdx : 5; // : 5 index of associated co-located motion data buffer |
| 1791 |
unsigned int frame_num : 16; // |
| 1792 |
unsigned int frame_surfaces : 1; // frame surfaces flag |
| 1793 |
unsigned int output_memory_layout : 1; // 0: NV12; 1:NV24. Field pair must use the same setting. |
| 1794 |
|
| 1795 |
int CurrFieldOrderCnt[2]; // : 32 [Top_Bottom], [0]=TopFieldOrderCnt, [1]=BottomFieldOrderCnt |
| 1796 |
nvdec_dpb_entry_s dpb[16]; |
| 1797 |
unsigned char WeightScale[6][4][4]; // : 6*4*4*8 in raster scan order (not zig-zag order) |
| 1798 |
unsigned char WeightScale8x8[2][8][8]; // : 2*8*8*8 in raster scan order (not zig-zag order) |
| 1799 |
|
| 1800 |
// mvc setup info, must be zero if not mvc |
| 1801 |
unsigned char num_inter_view_refs_lX[2]; // number of inter-view references |
| 1802 |
char reserved1[14]; // reserved for alignment |
| 1803 |
signed char inter_view_refidx_lX[2][16]; // DPB indices (must also be marked as long-term) |
| 1804 |
|
| 1805 |
// lossless decode (At the time of writing this manual, x264 and JM encoders, differ in Intra_8x8 reference sample filtering) |
| 1806 |
unsigned int lossless_ipred8x8_filter_enable : 1; // = 0, skips Intra_8x8 reference sample filtering, for vertical and horizontal predictions (x264 encoded streams); = 1, filter Intra_8x8 reference samples (JM encoded streams) |
| 1807 |
unsigned int qpprime_y_zero_transform_bypass_flag : 1; // determines the transform bypass mode |
| 1808 |
unsigned int reserved2 : 30; // kept for alignment; may be used for other parameters |
| 1809 |
|
| 1810 |
nvdec_display_param_s displayPara; |
| 1811 |
nvdec_pass2_otf_ext_s ssm; |
| 1812 |
|
| 1813 |
} nvdec_new_h264_pic_s; |
| 1814 |
|
| 1815 |
// golden crc struct dumped into surface |
| 1816 |
// for each part, if golden crc compare is enabled, one interface is selected to do crc calculation in vmod. |
| 1817 |
// vmod's crc is compared with cmod's golden crc (4*32 bits), and compare reuslt is written into surface. |
| 1818 |
typedef struct |
| 1819 |
{ |
| 1820 |
// input |
| 1821 |
unsigned int dbg_crc_enable_partb : 1; // Eable flag for enable/disable interface crc calculation in NVDEC HW's part b |
| 1822 |
unsigned int dbg_crc_enable_partc : 1; // Eable flag for enable/disable interface crc calculation in NVDEC HW's part c |
| 1823 |
unsigned int dbg_crc_enable_partd : 1; // Eable flag for enable/disable interface crc calculation in NVDEC HW's part d |
| 1824 |
unsigned int dbg_crc_enable_parte : 1; // Eable flag for enable/disable interface crc calculation in NVDEC HW's part e |
| 1825 |
unsigned int dbg_crc_intf_partb : 6; // For partb to select which interface to compare crc. see DBG_CRC_PARTE_INTF_SEL for detailed control value for each interface |
| 1826 |
unsigned int dbg_crc_intf_partc : 6; // For partc to select which interface to compare crc. see DBG_CRC_PARTE_INTF_SEL for detailed control value for each interface |
| 1827 |
unsigned int dbg_crc_intf_partd : 6; // For partd to select which interface to compare crc. see DBG_CRC_PARTE_INTF_SEL for detailed control value for each interface |
| 1828 |
unsigned int dbg_crc_intf_parte : 6; // For parte to select which interface to compare crc. see DBG_CRC_PARTE_INTF_SEL for detailed control value for each interface |
| 1829 |
unsigned int reserved0 : 4; |
| 1830 |
|
| 1831 |
unsigned int dbg_crc_partb_golden[4]; // Golden crc values for part b |
| 1832 |
unsigned int dbg_crc_partc_golden[4]; // Golden crc values for part c |
| 1833 |
unsigned int dbg_crc_partd_golden[4]; // Golden crc values for part d |
| 1834 |
unsigned int dbg_crc_parte_golden[4]; // Golden crc values for part e |
| 1835 |
|
| 1836 |
// output |
| 1837 |
unsigned int dbg_crc_comp_partb : 4; // Compare result for part b |
| 1838 |
unsigned int dbg_crc_comp_partc : 4; // Compare result for part c |
| 1839 |
unsigned int dbg_crc_comp_partd : 4; // Compare result for part d |
| 1840 |
unsigned int dbg_crc_comp_parte : 4; // Compare result for part e |
| 1841 |
unsigned int reserved1 : 16; |
| 1842 |
|
| 1843 |
unsigned char reserved2[56]; |
| 1844 |
}nvdec_crc_s; // 128 Bytes |
| 1845 |
|
| 1846 |
#endif // __DRV_NVDEC_H_ |