[h264d]: Fix fbc_hdr_offset error issue

The impl->width is invalid before it is initialized.
So move fbc_hdr_stride setup after impl->width is initialized.

This issue is introduced by:

commit 5469f9d08b
Author: Herman Chen <herman.chen@rock-chips.com>
Date:   Fri Dec 23 16:38:54 2022 +0800

    [misc]: Add compatible for fbc header alignment

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I3f3f4bfd2d84b813c900e05492eb6df5ea6f7a29
This commit is contained in:
Herman Chen
2022-12-30 16:44:07 +08:00
parent 9793b87ae2
commit e402a8423f
2 changed files with 15 additions and 6 deletions

View File

@@ -22,8 +22,9 @@
#include "mpp_mem.h"
#include "mpp_log.h"
#include "mpp_debug.h"
#include "hal_task.h"
#include "mpp_compat_impl.h"
#include "hal_task.h"
#include "avs2d_dpb.h"
#ifndef INT_MAX
@@ -483,7 +484,14 @@ static Avs2dFrame_t *dpb_alloc_frame(Avs2dCtx_t *p_dec, HalDecTask *task)
}
if (MPP_FRAME_FMT_IS_FBC(p_dec->init.cfg->base.out_fmt)) {
RK_U32 fbc_hdr_stride = MPP_ALIGN(vsh->horizontal_size, 64);
mpp_frame_set_fmt(mframe, mpp_frame_get_fmt(mframe) | (p_dec->init.cfg->base.out_fmt & (MPP_FRAME_FBC_MASK)));
if (*compat_ext_fbc_hdr_256_odd)
fbc_hdr_stride = MPP_ALIGN(vsh->horizontal_size, 256) | 256;
mpp_frame_set_fbc_hdr_stride(mframe, fbc_hdr_stride);
}
if (p_dec->is_hdr)

View File

@@ -465,6 +465,12 @@ static MPP_RET dpb_mark_malloc(H264dVideoCtx_t *p_Vid, H264_StorePic_t *dec_pic)
impl->hor_stride = hor_stride;
impl->ver_stride = ver_stride;
/* After cropped */
impl->width = p_Vid->width_after_crop;
impl->height = p_Vid->height_after_crop;
impl->pts = p_Vid->p_Cur->last_pts;
impl->dts = p_Vid->p_Cur->last_dts;
if (MPP_FRAME_FMT_IS_FBC(out_fmt)) {
impl->offset_x = 0;
impl->offset_y = 4;
@@ -477,11 +483,6 @@ static MPP_RET dpb_mark_malloc(H264dVideoCtx_t *p_Vid, H264_StorePic_t *dec_pic)
impl->fbc_hdr_stride = MPP_ALIGN(impl->width, 256) | 256;
}
/* After cropped */
impl->width = p_Vid->width_after_crop;
impl->height = p_Vid->height_after_crop;
impl->pts = p_Vid->p_Cur->last_pts;
impl->dts = p_Vid->p_Cur->last_dts;
/* Setting the interlace mode for the picture */
switch (structure) {
case FRAME: