media: hantro: HEVC: Fix output frame chroma offset
Hantro decoder doesn't take care of the requested and aligned size of the capture buffer. Stop using the bitstream width/height and use capture frame size stored in the context to get the correct values. hantro_hevc_chroma_offset() and hantro_hevc_motion_vectors_offset() are only used in hantro_g2_hevc_dec.c so take the opportunity to move them here. fluster HEVC score goes up from 77 to 85 successful tests (over 147) with this patch. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
79c987de8b
commit
579846ec52
@ -8,6 +8,20 @@
|
||||
#include "hantro_hw.h"
|
||||
#include "hantro_g2_regs.h"
|
||||
|
||||
#define G2_ALIGN 16
|
||||
|
||||
static size_t hantro_hevc_chroma_offset(struct hantro_ctx *ctx)
|
||||
{
|
||||
return ctx->dst_fmt.width * ctx->dst_fmt.height;
|
||||
}
|
||||
|
||||
static size_t hantro_hevc_motion_vectors_offset(struct hantro_ctx *ctx)
|
||||
{
|
||||
size_t cr_offset = hantro_hevc_chroma_offset(ctx);
|
||||
|
||||
return ALIGN((cr_offset * 3) / 2, G2_ALIGN);
|
||||
}
|
||||
|
||||
static void prepare_tile_info_buffer(struct hantro_ctx *ctx)
|
||||
{
|
||||
struct hantro_dev *vpu = ctx->dev;
|
||||
@ -335,7 +349,6 @@ static void set_ref_pic_list(struct hantro_ctx *ctx)
|
||||
static int set_ref(struct hantro_ctx *ctx)
|
||||
{
|
||||
const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls;
|
||||
const struct v4l2_ctrl_hevc_sps *sps = ctrls->sps;
|
||||
const struct v4l2_ctrl_hevc_pps *pps = ctrls->pps;
|
||||
const struct v4l2_ctrl_hevc_decode_params *decode_params = ctrls->decode_params;
|
||||
const struct v4l2_hevc_dpb_entry *dpb = decode_params->dpb;
|
||||
@ -343,8 +356,8 @@ static int set_ref(struct hantro_ctx *ctx)
|
||||
struct hantro_dev *vpu = ctx->dev;
|
||||
struct vb2_v4l2_buffer *vb2_dst;
|
||||
struct hantro_decoded_buffer *dst;
|
||||
size_t cr_offset = hantro_hevc_chroma_offset(sps);
|
||||
size_t mv_offset = hantro_hevc_motion_vectors_offset(sps);
|
||||
size_t cr_offset = hantro_hevc_chroma_offset(ctx);
|
||||
size_t mv_offset = hantro_hevc_motion_vectors_offset(ctx);
|
||||
u32 max_ref_frames;
|
||||
u16 dpb_longterm_e;
|
||||
static const struct hantro_reg cur_poc[] = {
|
||||
|
@ -27,23 +27,6 @@
|
||||
|
||||
#define UNUSED_REF -1
|
||||
|
||||
#define G2_ALIGN 16
|
||||
|
||||
size_t hantro_hevc_chroma_offset(const struct v4l2_ctrl_hevc_sps *sps)
|
||||
{
|
||||
int bytes_per_pixel = sps->bit_depth_luma_minus8 == 0 ? 1 : 2;
|
||||
|
||||
return sps->pic_width_in_luma_samples *
|
||||
sps->pic_height_in_luma_samples * bytes_per_pixel;
|
||||
}
|
||||
|
||||
size_t hantro_hevc_motion_vectors_offset(const struct v4l2_ctrl_hevc_sps *sps)
|
||||
{
|
||||
size_t cr_offset = hantro_hevc_chroma_offset(sps);
|
||||
|
||||
return ALIGN((cr_offset * 3) / 2, G2_ALIGN);
|
||||
}
|
||||
|
||||
static void hantro_hevc_ref_init(struct hantro_ctx *ctx)
|
||||
{
|
||||
struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec;
|
||||
|
@ -345,8 +345,6 @@ int hantro_hevc_dec_prepare_run(struct hantro_ctx *ctx);
|
||||
dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, int poc);
|
||||
int hantro_hevc_add_ref_buf(struct hantro_ctx *ctx, int poc, dma_addr_t addr);
|
||||
void hantro_hevc_ref_remove_unused(struct hantro_ctx *ctx);
|
||||
size_t hantro_hevc_chroma_offset(const struct v4l2_ctrl_hevc_sps *sps);
|
||||
size_t hantro_hevc_motion_vectors_offset(const struct v4l2_ctrl_hevc_sps *sps);
|
||||
|
||||
static inline unsigned short hantro_vp9_num_sbs(unsigned short dimension)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user