#define CBS_SIZE 16 /* compression table size in bytes */ #define CBS_LUMA 8 /* luminance CBS is composed of 1 8x8 coded block */ #define CBS_CHROMA_W (8 * 2) /* chrominance CBS is composed of two 8x4 coded * blocks, with Cb CB first then Cr CB following
*/ #define CBS_CHROMA_H 4
/** * struct hantro_aux_buf - auxiliary DMA buffer for hardware data * * @cpu: CPU pointer to the buffer. * @dma: DMA address of the buffer. * @size: Size of the buffer. * @attrs: Attributes of the DMA mapping.
*/ struct hantro_aux_buf { void *cpu;
dma_addr_t dma;
size_t size; unsignedlong attrs;
};
/* Max. number of entries in the DPB (HW limitation). */ #define HANTRO_H264_DPB_SIZE 16
/** * struct hantro_vp9_frame_info * * @valid: frame info valid flag * @frame_context_idx: index of frame context * @reference_mode: inter prediction type * @tx_mode: transform mode * @interpolation_filter: filter selection for inter prediction * @flags: frame flags * @timestamp: frame timestamp
*/ struct hantro_vp9_frame_info {
u32 valid : 1;
u32 frame_context_idx : 2;
u32 reference_mode : 2;
u32 tx_mode : 3;
u32 interpolation_filter : 3;
u32 flags;
u64 timestamp;
};
#define MAX_SB_COLS 64 #define MAX_SB_ROWS 34
/** * struct hantro_vp9_dec_hw_ctx * * @tile_edge: auxiliary DMA buffer for tile edge processing * @segment_map: auxiliary DMA buffer for segment map * @misc: auxiliary DMA buffer for tile info, probabilities and hw counters * @cnts: vp9 library struct for abstracting hw counters access * @probability_tables: VP9 probability tables implied by the spec * @frame_context: VP9 frame contexts * @cur: current frame information * @last: last frame information * @bsd_ctrl_offset: bsd offset into tile_edge * @segment_map_size: size of segment map * @ctx_counters_offset: hw counters offset into misc * @tile_info_offset: tile info offset into misc * @tile_r_info: per-tile information array * @tile_c_info: per-tile information array * @last_tile_r: last number of tile rows * @last_tile_c: last number of tile cols * @last_sbs_r: last number of superblock rows * @last_sbs_c: last number of superblock cols * @active_segment: number of active segment (alternating between 0 and 1) * @feature_enabled: segmentation feature enabled flags * @feature_data: segmentation feature data
*/ struct hantro_vp9_dec_hw_ctx { struct hantro_aux_buf tile_edge; struct hantro_aux_buf segment_map; struct hantro_aux_buf misc; struct v4l2_vp9_frame_symbol_counts cnts; struct v4l2_vp9_frame_context probability_tables; struct v4l2_vp9_frame_context frame_context[4]; struct hantro_vp9_frame_info cur; struct hantro_vp9_frame_info last;
struct hantro_av1_frame_ref { int width; int height; int mi_cols; int mi_rows;
u64 timestamp; enum v4l2_av1_frame_type frame_type; bool used;
u32 order_hint;
u32 order_hints[V4L2_AV1_TOTAL_REFS_PER_FRAME]; struct vb2_v4l2_buffer *vb2_ref;
};
/** * struct hantro_av1_dec_hw_ctx * @db_data_col: db tile col data buffer * @db_ctrl_col: db tile col ctrl buffer * @cdef_col: cdef tile col buffer * @sr_col: sr tile col buffer * @lr_col: lr tile col buffer * @global_model: global model buffer * @tile_info: tile info buffer * @segment: segmentation info buffer * @film_grain: film grain buffer * @prob_tbl: probability table * @prob_tbl_out: probability table output * @tile_buf: tile buffer * @ctrls: V4L2 controls attached to a run * @frame_refs: reference frames info slots * @ref_frame_sign_bias: array of sign bias * @num_tile_cols_allocated: number of allocated tiles * @cdfs: current probabilities structure * @cdfs_ndvc: current mv probabilities structure * @default_cdfs: default probabilities structure * @default_cdfs_ndvc: default mv probabilties structure * @cdfs_last: stored probabilities structures * @cdfs_last_ndvc: stored mv probabilities structures * @current_frame_index: index of the current in frame_refs array
*/ struct hantro_av1_dec_hw_ctx { struct hantro_aux_buf db_data_col; struct hantro_aux_buf db_ctrl_col; struct hantro_aux_buf cdef_col; struct hantro_aux_buf sr_col; struct hantro_aux_buf lr_col; struct hantro_aux_buf global_model; struct hantro_aux_buf tile_info; struct hantro_aux_buf segment; struct hantro_aux_buf film_grain; struct hantro_aux_buf prob_tbl; struct hantro_aux_buf prob_tbl_out; struct hantro_aux_buf tile_buf; struct hantro_av1_dec_ctrls ctrls; struct hantro_av1_frame_ref frame_refs[AV1_MAX_FRAME_BUF_COUNT];
u32 ref_frame_sign_bias[V4L2_AV1_TOTAL_REFS_PER_FRAME]; unsignedint num_tile_cols_allocated; struct av1cdfs *cdfs; struct mvcdfs *cdfs_ndvc; struct av1cdfs default_cdfs; struct mvcdfs default_cdfs_ndvc; struct av1cdfs cdfs_last[NUM_REF_FRAMES]; struct mvcdfs cdfs_last_ndvc[NUM_REF_FRAMES]; int current_frame_index;
}; /** * struct hantro_postproc_ctx * * @dec_q: References buffers, in decoder format.
*/ struct hantro_postproc_ctx { struct hantro_aux_buf dec_q[MAX_POSTPROC_BUFFERS];
};
/** * struct hantro_postproc_ops - post-processor operations * * @enable: Enable the post-processor block. Optional. * @disable: Disable the post-processor block. Optional. * @enum_framesizes: Enumerate possible scaled output formats. * Returns zero if OK, a negative value in error cases. * Optional.
*/ struct hantro_postproc_ops { void (*enable)(struct hantro_ctx *ctx); void (*disable)(struct hantro_ctx *ctx); int (*enum_framesizes)(struct hantro_ctx *ctx, struct v4l2_frmsizeenum *fsize);
};
/** * struct hantro_codec_ops - codec mode specific operations * * @init: If needed, can be used for initialization. * Optional and called from process context. * @exit: If needed, can be used to undo the .init phase. * Optional and called from process context. * @run: Start single {en,de)coding job. Called from atomic context * to indicate that a pair of buffers is ready and the hardware * should be programmed and started. Returns zero if OK, a * negative value in error cases. * @done: Read back processing results and additional data from hardware. * @reset: Reset the hardware in case of a timeout.
*/ struct hantro_codec_ops { int (*init)(struct hantro_ctx *ctx); void (*exit)(struct hantro_ctx *ctx); int (*run)(struct hantro_ctx *ctx); void (*done)(struct hantro_ctx *ctx); void (*reset)(struct hantro_ctx *ctx);
};
/** * enum hantro_enc_fmt - source format ID for hardware registers. * * @ROCKCHIP_VPU_ENC_FMT_YUV420P: Y/CbCr 4:2:0 planar format * @ROCKCHIP_VPU_ENC_FMT_YUV420SP: Y/CbCr 4:2:0 semi-planar format * @ROCKCHIP_VPU_ENC_FMT_YUYV422: YUV 4:2:2 packed format (YUYV) * @ROCKCHIP_VPU_ENC_FMT_UYVY422: YUV 4:2:2 packed format (UYVY)
*/ enum hantro_enc_fmt {
ROCKCHIP_VPU_ENC_FMT_YUV420P = 0,
ROCKCHIP_VPU_ENC_FMT_YUV420SP = 1,
ROCKCHIP_VPU_ENC_FMT_YUYV422 = 2,
ROCKCHIP_VPU_ENC_FMT_UYVY422 = 3,
};
staticinline size_t
hantro_vp9_mv_size(unsignedint width, unsignedint height)
{ int num_ctbs;
/* * There can be up to (CTBs x 64) number of blocks, * and the motion vector for each block needs 16 bytes.
*/
num_ctbs = hantro_vp9_num_sbs(width) * hantro_vp9_num_sbs(height); return (num_ctbs * 64) * 16;
}
staticinline size_t
hantro_h264_mv_size(unsignedint width, unsignedint height)
{ /* * A decoded 8-bit 4:2:0 NV12 frame may need memory for up to * 448 bytes per macroblock with additional 32 bytes on * multi-core variants. * * The H264 decoder needs extra space on the output buffers * to store motion vectors. This is needed for reference * frames and only if the format is non-post-processed NV12. * * Memory layout is as follow: * * +---------------------------+ * | Y-plane 256 bytes x MBs | * +---------------------------+ * | UV-plane 128 bytes x MBs | * +---------------------------+ * | MV buffer 64 bytes x MBs | * +---------------------------+ * | MC sync 32 bytes | * +---------------------------+
*/ return 64 * MB_WIDTH(width) * MB_WIDTH(height) + 32;
}
staticinline size_t
hantro_hevc_mv_size(unsignedint width, unsignedint height)
{ /* * A CTB can be 64x64, 32x32 or 16x16. * Allocated memory for the "worse" case: 16x16
*/ return width * height / 16;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.