55 files changed, 11471 insertions, 2282 deletions
diff --git a/drivers/amvdec_ports/decoder/aml_vp9_parser.h b/drivers/amvdec_ports/decoder/aml_vp9_parser.h index 731b1a6..b9f4489 100755..100644 --- a/drivers/amvdec_ports/decoder/aml_vp9_parser.h +++ b/drivers/amvdec_ports/decoder/aml_vp9_parser.h @@ -15,165 +15,160 @@ * */ - #ifndef AML_VP9_PARSER_H #define AML_VP9_PARSER_H -enum BlockPartition { - PARTITION_NONE, // [ ] <-. - PARTITION_H, // [-] | - PARTITION_V, // [|] | - PARTITION_SPLIT, // [+] --' -}; +#include "../utils/pixfmt.h" +#include "../utils/get_bits.h" -enum InterPredMode { - NEARESTMV = 10, - NEARMV = 11, - ZEROMV = 12, - NEWMV = 13, -}; +#define MAX_SEGMENT 8 -enum CompPredMode { - PRED_SINGLEREF, - PRED_COMPREF, - PRED_SWITCHABLE, -}; +struct VP9BitstreamHeader { + // bitstream header + u8 profile; + u8 bpp; + u8 keyframe; + u8 invisible; + u8 errorres; + u8 intraonly; + u8 resetctx; + u8 refreshrefmask; + u8 highprecisionmvs; + u8 allowcompinter; + u8 refreshctx; + u8 parallelmode; + u8 framectxid; + u8 use_last_frame_mvs; + u8 refidx[3]; + u8 signbias[3]; + u8 fixcompref; + u8 varcompref[2]; + struct { + u8 level; + char sharpness; + } filter; + struct { + u8 enabled; + u8 updated; + char mode[2]; + char ref[4]; + } lf_delta; + u8 yac_qi; + char ydc_qdelta, uvdc_qdelta, uvac_qdelta; + u8 lossless; + struct { + u8 enabled; + u8 temporal; + u8 absolute_vals; + u8 update_map; + u8 prob[7]; + u8 pred_prob[3]; + struct { + u8 q_enabled; + u8 lf_enabled; + u8 ref_enabled; + u8 skip_enabled; + u8 ref_val; + int16_t q_val; + char lf_val; + int16_t qmul[2][2]; + u8 lflvl[4][2]; + } feat[MAX_SEGMENT]; + } segmentation; + struct { + u32 log2_tile_cols, log2_tile_rows; + u32 tile_cols, tile_rows; + } tiling; -enum BlockLevel { - BL_64X64, - BL_32X32, - BL_16X16, - BL_8X8, + int uncompressed_header_size; + int compressed_header_size; }; -enum BlockSize { - BS_64x64, - BS_64x32, - BS_32x64, - BS_32x32, - BS_32x16, - BS_16x32, - BS_16x16, - BS_16x8, - BS_8x16, - BS_8x8, - BS_8x4, - BS_4x8, - BS_4x4, - N_BS_SIZES, -}; +struct VP9SharedContext { + struct VP9BitstreamHeader h; -enum FilterMode { - MODE_NONE, - MODE_INTERLEAVE, - MODE_DEINTERLEAVE + //struct ThreadFrame refs[8]; +#define CUR_FRAME 0 +#define REF_FRAME_MVPAIR 1 +#define REF_FRAME_SEGMAP 2 + //struct VP9Frame frames[3]; }; -enum TxfmMode { - TX_4X4, - TX_8X8, - TX_16X16, - TX_32X32, - N_TXFM_SIZES, - TX_SWITCHABLE = N_TXFM_SIZES, - N_TXFM_MODES -}; +struct VP9Context { + struct VP9SharedContext s; + struct get_bits_context gb; + int pass, active_tile_cols; -enum TxfmType { - DCT_DCT, - DCT_ADST, - ADST_DCT, - ADST_ADST, - N_TXFM_TYPES -}; + u8 ss_h, ss_v; + u8 last_bpp, bpp_index, bytesperpixel; + u8 last_keyframe; + // sb_cols/rows, rows/cols and last_fmt are used for allocating all internal + // arrays, and are thus per-thread. w/h and gf_fmt are synced between threads + // and are therefore per-stream. pix_fmt represents the value in the header + // of the currently processed frame. + int width; + int height; -enum IntraPredMode { - VERT_PRED, - HOR_PRED, - DC_PRED, - DIAG_DOWN_LEFT_PRED, - DIAG_DOWN_RIGHT_PRED, - VERT_RIGHT_PRED, - HOR_DOWN_PRED, - VERT_LEFT_PRED, - HOR_UP_PRED, - TM_VP8_PRED, - LEFT_DC_PRED, - TOP_DC_PRED, - DC_128_PRED, - DC_127_PRED, - DC_129_PRED, - N_INTRA_PRED_MODES + int render_width; + int render_height; + + enum AVPixelFormat pix_fmt, last_fmt, gf_fmt; + u32 sb_cols, sb_rows, rows, cols; + + struct { + u8 lim_lut[64]; + u8 mblim_lut[64]; + } filter_lut; + struct { + u8 coef[4][2][2][6][6][3]; + } prob_ctx[4]; + struct { + u8 coef[4][2][2][6][6][11]; + } prob; + + // contextual (above) cache + u8 *above_partition_ctx; + u8 *above_mode_ctx; + // FIXME maybe merge some of the below in a flags field? + u8 *above_y_nnz_ctx; + u8 *above_uv_nnz_ctx[2]; + u8 *above_skip_ctx; // 1bit + u8 *above_txfm_ctx; // 2bit + u8 *above_segpred_ctx; // 1bit + u8 *above_intra_ctx; // 1bit + u8 *above_comp_ctx; // 1bit + u8 *above_ref_ctx; // 2bit + u8 *above_filter_ctx; + + // whole-frame cache + u8 *intra_pred_data[3]; + + // block reconstruction intermediates + int block_alloc_using_2pass; + uint16_t mvscale[3][2]; + u8 mvstep[3][2]; }; -struct VP9BitstreamHeader { - // bitstream header - u8 profile; - u8 bpp; - u8 keyframe; - u8 invisible; - u8 errorres; - u8 intraonly; - u8 resetctx; - u8 refreshrefmask; - u8 highprecisionmvs; - enum FilterMode filtermode; - u8 allowcompinter; - u8 refreshctx; - u8 parallelmode; - u8 framectxid; - u8 use_last_frame_mvs; - u8 refidx[3]; - u8 signbias[3]; - u8 fixcompref; - u8 varcompref[2]; - struct { - u8 level; - int8_t sharpness; - } filter; - struct { - u8 enabled; - u8 updated; - char mode[2]; - char ref[4]; - } lf_delta; - u8 yac_qi; - char ydc_qdelta, uvdc_qdelta, uvac_qdelta; - u8 lossless; -#define MAX_SEGMENT 8 - struct { - u8 enabled; - u8 temporal; - u8 absolute_vals; - u8 update_map; - u8 prob[7]; - u8 pred_prob[3]; - struct { - u8 q_enabled; - u8 lf_enabled; - u8 ref_enabled; - u8 skip_enabled; - u8 ref_val; - s16 q_val; - char lf_val; - s16 qmul[2][2]; - u8 lflvl[4][2]; - } feat[MAX_SEGMENT]; - } segmentation; - enum TxfmMode txfmmode; - enum CompPredMode comppredmode; - struct { - u32 log2_tile_cols, log2_tile_rows; - u32 tile_cols, tile_rows; - } tiling; - - int uncompressed_header_size; - int compressed_header_size; +struct vp9_superframe_split { + /*in data*/ + u8 *data; + u32 data_size; + + /*out data*/ + int nb_frames; + int size; + int next_frame; + u32 next_frame_offset; + int prefix_size; + int sizes[8]; }; -struct vp9_head_info_t { - bool parsed; - struct VP9BitstreamHeader info; +struct vp9_param_sets { + bool head_parsed; + struct VP9Context ctx; }; +int vp9_superframe_split_filter(struct vp9_superframe_split *s); +int vp9_decode_extradata_ps(u8 *data, int size, struct vp9_param_sets *ps); + #endif //AML_VP9_PARSER_H |