Multithreading changes and better error resilience
Fixed the following bugs Issue 21145276 Issue 21144884 Issue 21181133 Issue 21181134 Decoder now returns error if the level in stream is higher than level at init Change-Id: I8892c62bd98f7854d046510330c05a1e9ca826b2
This commit is contained in:
parent
25e8adb631
commit
caab4fe068
39 changed files with 11375 additions and 13115 deletions
|
|
@ -33,13 +33,11 @@
|
|||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
#ifndef _IHEVC_PLATFORM_MACROS_H_
|
||||
#define _IHEVC_PLATFORM_MACROS_H_
|
||||
#ifndef _IH264_PLATFORM_MACROS_H_
|
||||
#define _IH264_PLATFORM_MACROS_H_
|
||||
|
||||
#ifndef ARMV8
|
||||
void ih264_arm_dsb(void);
|
||||
|
||||
#define DATA_SYNC() ih264_arm_dsb()
|
||||
static __inline WORD32 CLIP_U8(WORD32 x)
|
||||
{
|
||||
asm("usat %0, #8, %1" : "=r"(x) : "r"(x));
|
||||
|
|
@ -93,8 +91,9 @@ static __inline UWORD32 ITT_BIG_ENDIAN(UWORD32 x)
|
|||
asm("rev %0, %1" : "=r"(x) : "r"(x));
|
||||
return x;
|
||||
}
|
||||
#define NOP(nop_cnt) {UWORD32 nop_i; for (nop_i = 0; nop_i < nop_cnt; nop_i++) asm("nop");}
|
||||
|
||||
#else
|
||||
#define DATA_SYNC() ;
|
||||
|
||||
#define CLIP_U8(x) CLIP3(0, 255, (x))
|
||||
#define CLIP_S8(x) CLIP3(-128, 127, (x))
|
||||
|
|
@ -108,12 +107,19 @@ static __inline UWORD32 ITT_BIG_ENDIAN(UWORD32 x)
|
|||
#define CLIP_U16(x) CLIP3(0, 65535, (x))
|
||||
#define CLIP_S16(x) CLIP3(-32768, 32767, (x))
|
||||
|
||||
#define ITT_BIG_ENDIAN(x) ((x & 0x000000ff) << 24) | \
|
||||
((x & 0x0000ff00) << 8) | \
|
||||
((x & 0x00ff0000) >> 8) | \
|
||||
((UWORD32)x >> 24);
|
||||
#define ITT_BIG_ENDIAN(x) __asm__("rev %0, %1" : "=r"(x) : "r"(x));
|
||||
|
||||
#define NOP(nop_cnt) \
|
||||
{ \
|
||||
UWORD32 nop_i; \
|
||||
for (nop_i = 0; nop_i < nop_cnt; nop_i++) \
|
||||
__asm__ __volatile__("mov x0, x0"); \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define DATA_SYNC() __sync_synchronize()
|
||||
|
||||
#define SHL(x,y) (((y) < 32) ? ((x) << (y)) : 0)
|
||||
#define SHR(x,y) (((y) < 32) ? ((x) >> (y)) : 0)
|
||||
|
||||
|
|
@ -141,12 +147,8 @@ static INLINE UWORD32 CTZ(UWORD32 u4_word)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#define NOP(nop_cnt) {UWORD32 nop_i; for (nop_i = 0; nop_i < nop_cnt; nop_i++);}
|
||||
|
||||
|
||||
#define MEM_ALIGN8 __attribute__ ((aligned (8)))
|
||||
#define MEM_ALIGN16 __attribute__ ((aligned (16)))
|
||||
#define MEM_ALIGN32 __attribute__ ((aligned (32)))
|
||||
|
||||
#endif /* _IHEVC_PLATFORM_MACROS_H_ */
|
||||
#endif /* _IH264_PLATFORM_MACROS_H_ */
|
||||
|
|
|
|||
|
|
@ -33,13 +33,11 @@
|
|||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
#ifndef _IHEVC_PLATFORM_MACROS_H_
|
||||
#define _IHEVC_PLATFORM_MACROS_H_
|
||||
#ifndef _IH264_PLATFORM_MACROS_H_
|
||||
#define _IH264_PLATFORM_MACROS_H_
|
||||
|
||||
#ifndef ARMV8
|
||||
void ih264_arm_dsb(void);
|
||||
|
||||
#define DATA_SYNC() ih264_arm_dsb()
|
||||
static __inline WORD32 CLIP_U8(WORD32 x)
|
||||
{
|
||||
asm("usat %0, #8, %1" : "=r"(x) : "r"(x));
|
||||
|
|
@ -93,8 +91,9 @@ static __inline UWORD32 ITT_BIG_ENDIAN(UWORD32 x)
|
|||
asm("rev %0, %1" : "=r"(x) : "r"(x));
|
||||
return x;
|
||||
}
|
||||
#define NOP(nop_cnt) {UWORD32 nop_i; for (nop_i = 0; nop_i < nop_cnt; nop_i++) asm("nop");}
|
||||
|
||||
#else
|
||||
#define DATA_SYNC() ;
|
||||
|
||||
#define CLIP_U8(x) CLIP3(0, 255, (x))
|
||||
#define CLIP_S8(x) CLIP3(-128, 127, (x))
|
||||
|
|
@ -108,12 +107,19 @@ static __inline UWORD32 ITT_BIG_ENDIAN(UWORD32 x)
|
|||
#define CLIP_U16(x) CLIP3(0, 65535, (x))
|
||||
#define CLIP_S16(x) CLIP3(-32768, 32767, (x))
|
||||
|
||||
#define ITT_BIG_ENDIAN(x) ((x & 0x000000ff) << 24) | \
|
||||
((x & 0x0000ff00) << 8) | \
|
||||
((x & 0x00ff0000) >> 8) | \
|
||||
((UWORD32)x >> 24);
|
||||
#define ITT_BIG_ENDIAN(x) __asm__("rev %0, %1" : "=r"(x) : "r"(x));
|
||||
|
||||
#define NOP(nop_cnt) \
|
||||
{ \
|
||||
UWORD32 nop_i; \
|
||||
for (nop_i = 0; nop_i < nop_cnt; nop_i++) \
|
||||
__asm__ __volatile__("mov x0, x0"); \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define DATA_SYNC() __sync_synchronize()
|
||||
|
||||
#define SHL(x,y) (((y) < 32) ? ((x) << (y)) : 0)
|
||||
#define SHR(x,y) (((y) < 32) ? ((x) >> (y)) : 0)
|
||||
|
||||
|
|
@ -141,12 +147,8 @@ static INLINE UWORD32 CTZ(UWORD32 u4_word)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#define NOP(nop_cnt) {UWORD32 nop_i; for (nop_i = 0; nop_i < nop_cnt; nop_i++);}
|
||||
|
||||
|
||||
#define MEM_ALIGN8 __attribute__ ((aligned (8)))
|
||||
#define MEM_ALIGN16 __attribute__ ((aligned (16)))
|
||||
#define MEM_ALIGN32 __attribute__ ((aligned (32)))
|
||||
|
||||
#endif /* _IHEVC_PLATFORM_MACROS_H_ */
|
||||
#endif /* _IH264_PLATFORM_MACROS_H_ */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -43,59 +43,148 @@
|
|||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @brief maximum range of cabac_init_idc (0-2)
|
||||
* @brief maximum range of cabac_init_idc (0-2) + 1 for ISLICE
|
||||
******************************************************************************
|
||||
*/
|
||||
#define IH264_NUM_CABAC_INIT_IDC_PLUS_ONE 4
|
||||
#define NUM_CAB_INIT_IDC_PLUS_ONE 4
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @brief max range of qps in H264 (0-51)
|
||||
******************************************************************************
|
||||
*/
|
||||
#define IH264_MAX_QP 52
|
||||
#define QP_RANGE 52
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @brief max range of cabac contexts in H264 (0-459)
|
||||
******************************************************************************
|
||||
*/
|
||||
#define IH264_NUM_CABAC_CTXTS 460
|
||||
#define NUM_CABAC_CTXTS 460
|
||||
|
||||
|
||||
/** Macros for Cabac checks */
|
||||
/** MbType */
|
||||
/** |x|x|I_PCM|SKIP|
|
||||
|S|Inter/Intra|P/B|NON-BD16x16/BD16x16,I16x16/I4x4| */
|
||||
#define CAB_INTRA 0x00 /* 0000 00xx */
|
||||
#define CAB_INTER 0x04 /* 0000 01xx */
|
||||
#define CAB_I4x4 0x00 /* 0000 00x0 */
|
||||
#define CAB_I16x16 0x01 /* 0000 00x1 */
|
||||
#define CAB_BD16x16 0x04 /* 0000 0100 */
|
||||
#define CAB_NON_BD16x16 0x05 /* 0000 0101 */
|
||||
#define CAB_P 0x07 /* 0000 0111 */
|
||||
#define CAB_SI4x4 0x08 /* 0000 10x0 */
|
||||
#define CAB_SI16x16 0x09 /* 0000 10x1 */
|
||||
#define CAB_SKIP_MASK 0x10 /* 0001 0000 */
|
||||
#define CAB_SKIP 0x10 /* 0001 0000 */
|
||||
#define CAB_P_SKIP 0x16 /* 0001 x11x */
|
||||
#define CAB_B_SKIP 0x14 /* 0001 x100 */
|
||||
#define CAB_BD16x16_MASK 0x07 /* 0000 0111 */
|
||||
#define CAB_INTRA_MASK 0x04 /* 0000 0100 */
|
||||
#define CAB_I_PCM 0x20 /* 001x xxxx */
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @enum ctxBlockCat
|
||||
|
||||
******************************************************************************
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LUMA_DC_CTXCAT = 0,
|
||||
LUMA_AC_CTXCAT = 1,
|
||||
LUMA_4X4_CTXCAT = 2,
|
||||
CHROMA_DC_CTXCAT = 3,
|
||||
CHROMA_AC_CTXCAT = 4,
|
||||
LUMA_8X8_CTXCAT = 5,
|
||||
NUM_CTX_CAT = 6
|
||||
} CTX_BLOCK_CAT;
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @enum ctxIdxOffset
|
||||
|
||||
******************************************************************************
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
MB_TYPE_SI_SLICE = 0,
|
||||
MB_TYPE_I_SLICE = 3,
|
||||
MB_SKIP_FLAG_P_SLICE = 11,
|
||||
MB_TYPE_P_SLICE = 14,
|
||||
SUB_MB_TYPE_P_SLICE = 21,
|
||||
MB_SKIP_FLAG_B_SLICE = 24,
|
||||
MB_TYPE_B_SLICE = 27,
|
||||
SUB_MB_TYPE_B_SLICE = 36,
|
||||
MVD_X = 40,
|
||||
MVD_Y = 47,
|
||||
REF_IDX = 54,
|
||||
MB_QP_DELTA = 60,
|
||||
INTRA_CHROMA_PRED_MODE = 64,
|
||||
PREV_INTRA4X4_PRED_MODE_FLAG = 68,
|
||||
REM_INTRA4X4_PRED_MODE = 69,
|
||||
MB_FIELD_DECODING_FLAG = 70,
|
||||
CBP_LUMA = 73,
|
||||
CBP_CHROMA = 77,
|
||||
CBF = 85,
|
||||
SIGNIFICANT_COEFF_FLAG_FRAME = 105,
|
||||
SIGNIFICANT_COEFF_FLAG_FLD = 277,
|
||||
LAST_SIGNIFICANT_COEFF_FLAG_FRAME = 166,
|
||||
LAST_SIGNIFICANT_COEFF_FLAG_FLD = 338,
|
||||
COEFF_ABS_LEVEL_MINUS1 = 227,
|
||||
|
||||
/* High profile related Syntax element CABAC offsets */
|
||||
TRANSFORM_SIZE_8X8_FLAG = 399,
|
||||
SIGNIFICANT_COEFF_FLAG_8X8_FRAME = 402,
|
||||
LAST_SIGNIFICANT_COEFF_FLAG_8X8_FRAME = 417,
|
||||
COEFF_ABS_LEVEL_MINUS1_8X8 = 426,
|
||||
SIGNIFICANT_COEFF_FLAG_8X8_FIELD = 436,
|
||||
LAST_SIGNIFICANT_COEFF_FLAG_8X8_FIELD = 451
|
||||
|
||||
} cabac_table_num_t;
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @enum ctxIdxOffset
|
||||
|
||||
******************************************************************************
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SIG_COEFF_CTXT_CAT_0_OFFSET = 0,
|
||||
SIG_COEFF_CTXT_CAT_1_OFFSET = 15,
|
||||
SIG_COEFF_CTXT_CAT_2_OFFSET = 29,
|
||||
SIG_COEFF_CTXT_CAT_3_OFFSET = 44,
|
||||
SIG_COEFF_CTXT_CAT_4_OFFSET = 47,
|
||||
SIG_COEFF_CTXT_CAT_5_OFFSET = 0,
|
||||
COEFF_ABS_LEVEL_CAT_0_OFFSET = 0,
|
||||
COEFF_ABS_LEVEL_CAT_1_OFFSET = 10,
|
||||
COEFF_ABS_LEVEL_CAT_2_OFFSET = 20,
|
||||
COEFF_ABS_LEVEL_CAT_3_OFFSET = 30,
|
||||
COEFF_ABS_LEVEL_CAT_4_OFFSET = 39,
|
||||
COEFF_ABS_LEVEL_CAT_5_OFFSET = 0
|
||||
} cabac_blk_cat_offset_t;
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Extern global declarations */
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @breif Table for rangeTabLPS depending on pStateIdx and qCodIRangeIdx
|
||||
* input : pStateIdx(0-63) and qCodIRangeIdx(0-3) [(Range >> 6) & 0x3]
|
||||
* output : RLps
|
||||
*
|
||||
* @remarks See Table 9-35 of H264 spec for rangeTabLPS
|
||||
*******************************************************************************
|
||||
*/
|
||||
extern const UWORD8 gau1_ih264_cabac_rlps[64][4];
|
||||
|
||||
/* CABAC Table declaration*/
|
||||
extern const UWORD32 gau4_ih264_cabac_table[128][4];
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @breif probability+MPS state transition tables based on cur State and bin
|
||||
* input : curpState[bits7-2] | curMPS[bit1] | decodedBin[bit0]
|
||||
* output : nextpState[bits6-1] | nextMPS[bit0]
|
||||
* @remarks Modified form of Table-9-36 State Transition table in H264 spec
|
||||
******************************************************************************
|
||||
*/
|
||||
extern const UWORD8 gau1_ih264_next_state[128*2];
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @brief Init context tables for all combinations of qp and cabac_init_idc
|
||||
* @remarks Packing format MPS in lsb and pState in bits[1-6]
|
||||
******************************************************************************
|
||||
*/
|
||||
extern const UWORD8 gau1_ih264_cab_ctxts[IH264_NUM_CABAC_INIT_IDC_PLUS_ONE][IH264_MAX_QP][IH264_NUM_CABAC_CTXTS];
|
||||
/*****************************************************************************/
|
||||
/* Cabac tables for context initialization depending upon type of Slice, */
|
||||
/* cabac init Idc value and Qp. */
|
||||
/*****************************************************************************/
|
||||
extern const UWORD8 gau1_ih264_cabac_ctxt_init_table[NUM_CAB_INIT_IDC_PLUS_ONE][QP_RANGE][NUM_CABAC_CTXTS];
|
||||
|
||||
|
||||
#endif /* IH264_CABAC_TABLES_H_ */
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ typedef enum
|
|||
/**
|
||||
******************************************************************************
|
||||
* @enum MBPART_PREDMODE_T
|
||||
* @brief MbPartPredMode Table 7-11 to 7-14
|
||||
* @brief MbPartps_pred_mode_ctxt Table 7-11 to 7-14
|
||||
******************************************************************************
|
||||
*/
|
||||
typedef enum
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef X86_MSVC
|
||||
#if defined(X86_MSVC) || defined (X86_MINGW)
|
||||
|
||||
#include <windows.h>
|
||||
#define SEM_MAX_COUNT 100
|
||||
|
|
|
|||
|
|
@ -62,13 +62,9 @@
|
|||
#define SHL_NEG(val,shift) ((shift<0)?(val>>(-shift)):(val<<shift))
|
||||
|
||||
|
||||
#define ITT_BIG_ENDIAN(x) ((x << 24)) | \
|
||||
((x & 0x0000ff00) << 8) | \
|
||||
((x & 0x00ff0000) >> 8) | \
|
||||
((UWORD32)x >> 24);
|
||||
#define ITT_BIG_ENDIAN(x) __builtin_bswap32(x);
|
||||
|
||||
|
||||
#define NOP(nop_cnt) {UWORD32 nop_i; for (nop_i = 0; nop_i < nop_cnt; nop_i++);}
|
||||
#define NOP(nop_cnt) {UWORD32 nop_i; for (nop_i = 0; nop_i < nop_cnt; nop_i++) asm("nop");}
|
||||
|
||||
#define PLD(a)
|
||||
|
||||
|
|
@ -97,7 +93,7 @@ static __inline UWORD32 CTZ(UWORD32 u4_word)
|
|||
|
||||
|
||||
//#define INLINE __inline
|
||||
#define INLINE
|
||||
#define INLINE inline
|
||||
|
||||
#define PREFETCH_ENABLE 1
|
||||
|
||||
|
|
|
|||
|
|
@ -897,8 +897,7 @@ void ih264_hadamard_quant_2x2_uv_sse42(WORD16 *pi2_src, WORD16 *pi2_dst,
|
|||
const UWORD16 *pu2_threshold_matrix, UWORD32 u4_qbits,
|
||||
UWORD32 u4_round_factor,UWORD8 *pu1_nnz)
|
||||
{
|
||||
WORD32 val, nonzero_coeff_0, nonzero_coeff_1=0;
|
||||
nonzero_coeff_0 = 0;
|
||||
WORD32 val, nonzero_coeff_0=0, nonzero_coeff_1=0;
|
||||
__m128i cmp, cmp0, cmp1;
|
||||
__m128i sum0, sum1;
|
||||
WORD32 mask, mask0, mask1;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ IV_API_CALL_STATUS_T ih264d_api_function(iv_obj_t *ps_handle, void *pv_api_ip,vo
|
|||
typedef enum {
|
||||
|
||||
IH264D_VID_HDR_DEC_NUM_FRM_BUF_NOT_SUFFICIENT = IVD_DUMMY_ELEMENT_FOR_CODEC_EXTENSIONS + 1,
|
||||
IH264D_UNSUPPORTED_LEVEL = IVD_DUMMY_ELEMENT_FOR_CODEC_EXTENSIONS + 2
|
||||
|
||||
}IH264D_ERROR_CODES_T;
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@
|
|||
#include "ih264d_utils.h"
|
||||
#include "ih264d_format_conv.h"
|
||||
#include "ih264d_parse_headers.h"
|
||||
#include "ih264d_thread_compute_bs.h"
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
|
|
@ -121,7 +122,7 @@
|
|||
|
||||
#define MAX_NAL_UNIT_SIZE MAX((H264_MAX_FRAME_HEIGHT * H264_MAX_FRAME_HEIGHT),MIN_NALUNIT_SIZE)
|
||||
#define MIN_NALUNIT_SIZE 200000
|
||||
#define FMT_CONV_NUM_ROWS 4
|
||||
|
||||
|
||||
#define MIN_IN_BUFS 1
|
||||
#define MIN_OUT_BUFS_420 3
|
||||
|
|
@ -283,8 +284,8 @@ static IV_API_CALL_STATUS_T api_check_struct_sanity(iv_obj_t *ps_handle,
|
|||
WORD32 max_wd = ps_ip->s_ivd_fill_mem_rec_ip_t.u4_max_frm_wd;
|
||||
WORD32 max_ht = ps_ip->s_ivd_fill_mem_rec_ip_t.u4_max_frm_ht;
|
||||
|
||||
max_wd = ((max_wd + 15) >> 4) << 4;
|
||||
max_ht = ((max_ht + 15) >> 4) << 4;
|
||||
max_wd = ALIGN16(max_wd);
|
||||
max_ht = ALIGN32(max_ht);
|
||||
|
||||
ps_op->s_ivd_fill_mem_rec_op_t.u4_error_code = 0;
|
||||
|
||||
|
|
@ -383,8 +384,8 @@ static IV_API_CALL_STATUS_T api_check_struct_sanity(iv_obj_t *ps_handle,
|
|||
WORD32 max_wd = ps_ip->s_ivd_init_ip_t.u4_frm_max_wd;
|
||||
WORD32 max_ht = ps_ip->s_ivd_init_ip_t.u4_frm_max_ht;
|
||||
|
||||
max_wd = ((max_wd + 15) >> 4) << 4;
|
||||
max_ht = ((max_ht + 15) >> 4) << 4;
|
||||
max_wd = ALIGN16(max_wd);
|
||||
max_ht = ALIGN32(max_ht);
|
||||
|
||||
ps_op->s_ivd_init_op_t.u4_error_code = 0;
|
||||
|
||||
|
|
@ -1479,7 +1480,7 @@ void ih264d_init_decoder(void * ps_dec_params)
|
|||
ps_dec->ps_cur_pps = NULL;
|
||||
ps_dec->ps_cur_sps = NULL;
|
||||
ps_dec->u1_init_dec_flag = 0;
|
||||
ps_dec->u1_first_nal_in_pic = 1;
|
||||
ps_dec->u1_first_slice_in_stream = 1;
|
||||
ps_dec->u1_first_pb_nal_in_pic = 1;
|
||||
ps_dec->u1_last_pic_not_decoded = 0;
|
||||
ps_dec->u4_app_disp_width = 0;
|
||||
|
|
@ -1627,6 +1628,9 @@ void ih264d_init_decoder(void * ps_dec_params)
|
|||
|
||||
ps_dec->init_done = 1;
|
||||
ps_dec->process_called = 1;
|
||||
|
||||
ps_dec->pv_pic_buf_mgr = NULL;
|
||||
ps_dec->pv_mv_buf_mgr = NULL;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
|
@ -1759,7 +1763,7 @@ WORD32 ih264d_init_video_decoder(iv_obj_t *dec_hdl,
|
|||
ps_dec->u4_height_at_init = ps_init_ip->s_ivd_init_ip_t.u4_frm_max_ht;
|
||||
|
||||
ps_dec->u4_width_at_init = ALIGN16(ps_dec->u4_width_at_init);
|
||||
ps_dec->u4_height_at_init = ALIGN16(ps_dec->u4_height_at_init);
|
||||
ps_dec->u4_height_at_init = ALIGN32(ps_dec->u4_height_at_init);
|
||||
|
||||
ps_dec->pv_dec_thread_handle = memtab[MEM_REC_THREAD_HANDLE].pv_base;
|
||||
|
||||
|
|
@ -1938,8 +1942,8 @@ WORD32 ih264d_fill_num_mem_rec(void *pv_api_ip, void *pv_api_op)
|
|||
luma_height = ps_mem_q_ip->s_ivd_fill_mem_rec_ip_t.u4_max_frm_ht;
|
||||
luma_width = ps_mem_q_ip->s_ivd_fill_mem_rec_ip_t.u4_max_frm_wd;
|
||||
|
||||
luma_height = ((luma_height + 15) >> 4) << 4;
|
||||
luma_width = ((luma_width + 15) >> 4) << 4;
|
||||
luma_height = ALIGN32(luma_height);
|
||||
luma_width = ALIGN16(luma_width);
|
||||
luma_width_in_mbs = luma_width >> 4;
|
||||
luma_height_in_mbs = luma_height >> 4;
|
||||
u4_total_num_mbs = (luma_height * luma_width) >> 8;
|
||||
|
|
@ -2081,7 +2085,7 @@ WORD32 ih264d_fill_num_mem_rec(void *pv_api_ip, void *pv_api_op)
|
|||
memTab[MEM_REC_DEBLK_MB_INFO].e_mem_type =
|
||||
IV_EXTERNAL_CACHEABLE_PERSISTENT_MEM;
|
||||
memTab[MEM_REC_DEBLK_MB_INFO].u4_mem_size = (((((u4_total_num_mbs
|
||||
+ MAX_MBS_IN_ROW) * sizeof(deblk_mb_t)) + 127) >> 7) << 7);
|
||||
+ (luma_width >> 4)) * sizeof(deblk_mb_t)) + 127) >> 7) << 7);
|
||||
|
||||
memTab[MEM_REC_NEIGHBOR_INFO].u4_mem_alignment = (128 * 8) / CHAR_BIT;
|
||||
memTab[MEM_REC_NEIGHBOR_INFO].e_mem_type =
|
||||
|
|
@ -2125,10 +2129,14 @@ WORD32 ih264d_fill_num_mem_rec(void *pv_api_ip, void *pv_api_op)
|
|||
memTab[MEM_REC_COEFF_DATA].e_mem_type =
|
||||
IV_EXTERNAL_CACHEABLE_PERSISTENT_MEM;
|
||||
memTab[MEM_REC_COEFF_DATA].u4_mem_size = MB_LUM_SIZE * sizeof(WORD16);
|
||||
/*For I16x16 MBs, 16 4x4 AC coeffs and 1 4x4 DC coeff TU blocks will be sent
|
||||
For all MBs along with 8 4x4 AC coeffs 2 2x2 DC coeff TU blocks will be sent
|
||||
So use 17 4x4 TU blocks for luma and 9 4x4 TU blocks for chroma */
|
||||
memTab[MEM_REC_COEFF_DATA].u4_mem_size += u4_num_entries
|
||||
* (MAX(16 * sizeof(tu_sblk4x4_coeff_data_t),4 * sizeof(tu_blk8x8_coeff_data_t))
|
||||
+ 8 * sizeof(tu_sblk4x4_coeff_data_t));
|
||||
memTab[MEM_REC_COEFF_DATA].u4_mem_size += u4_num_entries * 32; //32 bytes for each mb to store u1_prev_intra4x4_pred_mode and u1_rem_intra4x4_pred_mode data
|
||||
* (MAX(17 * sizeof(tu_sblk4x4_coeff_data_t),4 * sizeof(tu_blk8x8_coeff_data_t))
|
||||
+ 9 * sizeof(tu_sblk4x4_coeff_data_t));
|
||||
//32 bytes for each mb to store u1_prev_intra4x4_pred_mode and u1_rem_intra4x4_pred_mode data
|
||||
memTab[MEM_REC_COEFF_DATA].u4_mem_size += u4_num_entries * 32;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -2173,10 +2181,10 @@ WORD32 ih264d_fill_num_mem_rec(void *pv_api_ip, void *pv_api_op)
|
|||
u4_mem_size += sizeof(UWORD32) * (MAX_REF_BUFS * MAX_REF_BUFS);
|
||||
u4_mem_size = ALIGN64(u4_mem_size);
|
||||
|
||||
u4_mem_size += MAX_REF_BUF_SIZE;
|
||||
u4_mem_size += MAX_REF_BUF_SIZE * 2;
|
||||
u4_mem_size = ALIGN64(u4_mem_size);
|
||||
u4_mem_size += ((sizeof(WORD16)) * PRED_BUFFER_WIDTH
|
||||
* PRED_BUFFER_HEIGHT);
|
||||
* PRED_BUFFER_HEIGHT * 2);
|
||||
u4_mem_size = ALIGN64(u4_mem_size);
|
||||
u4_mem_size += sizeof(UWORD8) * (MB_LUM_SIZE);
|
||||
u4_mem_size = ALIGN64(u4_mem_size);
|
||||
|
|
@ -2243,18 +2251,17 @@ WORD32 ih264d_fill_num_mem_rec(void *pv_api_ip, void *pv_api_op)
|
|||
u4_mem_used = ALIGN64(u4_mem_used);
|
||||
u4_mem_used += sizeof(UWORD8) * (luma_width + 16) * 2;
|
||||
u4_mem_used = ALIGN64(u4_mem_used);
|
||||
u4_mem_used += sizeof(UWORD8) * ((luma_width >> 1) + 16) * 2
|
||||
* YUV420SP_FACTOR;
|
||||
u4_mem_used += sizeof(UWORD8) * (luma_width + 16) * 2;
|
||||
u4_mem_used = ALIGN64(u4_mem_used);
|
||||
u4_mem_used += sizeof(UWORD8) * ((luma_width >> 1) + 16) * 2;
|
||||
u4_mem_used += sizeof(UWORD8) * (luma_width + 16) * 2;
|
||||
u4_mem_used = ALIGN64(u4_mem_used);
|
||||
u4_mem_used += sizeof(mb_neigbour_params_t) * (luma_width_in_mbs + 1)
|
||||
* luma_height_in_mbs;
|
||||
u4_mem_used += luma_width;
|
||||
u4_mem_used = ALIGN64(u4_mem_used);
|
||||
u4_mem_used += luma_width >> 1;
|
||||
u4_mem_used += luma_width;
|
||||
u4_mem_used = ALIGN64(u4_mem_used);
|
||||
u4_mem_used += luma_width >> 1;
|
||||
u4_mem_used += luma_width;
|
||||
u4_mem_used = ALIGN64(u4_mem_used);
|
||||
|
||||
u4_mem_used += ((MB_SIZE + 4) << 1) * PAD_LEN_Y_H;
|
||||
|
|
@ -2272,7 +2279,7 @@ WORD32 ih264d_fill_num_mem_rec(void *pv_api_ip, void *pv_api_op)
|
|||
|
||||
memTab[MEM_REC_BITSBUF].u4_mem_alignment = (128 * 8) / CHAR_BIT;
|
||||
memTab[MEM_REC_BITSBUF].e_mem_type = IV_EXTERNAL_CACHEABLE_PERSISTENT_MEM;
|
||||
memTab[MEM_REC_BITSBUF].u4_mem_size = MAX(256000, (luma_width * luma_height));
|
||||
memTab[MEM_REC_BITSBUF].u4_mem_size = MAX(256000, (luma_width * luma_height * 3 / 2));
|
||||
|
||||
{
|
||||
|
||||
|
|
@ -2394,8 +2401,10 @@ WORD32 ih264d_clr(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
return IV_FAIL;
|
||||
}
|
||||
|
||||
ih264_buf_mgr_free((buf_mgr_t *)ps_dec->pv_pic_buf_mgr);
|
||||
ih264_buf_mgr_free((buf_mgr_t *)ps_dec->pv_mv_buf_mgr);
|
||||
if(ps_dec->pv_pic_buf_mgr)
|
||||
ih264_buf_mgr_free((buf_mgr_t *)ps_dec->pv_pic_buf_mgr);
|
||||
if(ps_dec->pv_mv_buf_mgr)
|
||||
ih264_buf_mgr_free((buf_mgr_t *)ps_dec->pv_mv_buf_mgr);
|
||||
|
||||
memcpy(dec_clr_ip->pv_mem_rec_location, ps_dec->ps_mem_tab,
|
||||
MEM_REC_CNT * (sizeof(iv_mem_rec_t)));
|
||||
|
|
@ -2590,7 +2599,7 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
UWORD32 cur_slice_is_nonref = 0;
|
||||
UWORD32 u4_next_is_aud;
|
||||
UWORD32 u4_first_start_code_found = 0;
|
||||
WORD32 ret;
|
||||
WORD32 ret,api_ret_value = IV_SUCCESS;
|
||||
WORD32 header_data_left = 0,frame_data_left = 0;
|
||||
UWORD8 *pu1_bitstrm_buf;
|
||||
ithread_set_name((void*)"Parse_thread");
|
||||
|
|
@ -2602,7 +2611,6 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
ps_dec_op = (ivd_video_decode_op_t *)pv_api_op;
|
||||
ps_dec->pv_dec_out = ps_dec_op;
|
||||
ps_dec->process_called = 1;
|
||||
ps_dec->u2_mb_skip_error = 0;
|
||||
if(ps_dec->init_done != 1)
|
||||
{
|
||||
return IV_FAIL;
|
||||
|
|
@ -2637,20 +2645,13 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
>= offsetof(ivd_video_decode_ip_t, s_out_buffer))
|
||||
ps_dec->ps_out_buffer = &ps_dec_ip->s_out_buffer;
|
||||
|
||||
if(ps_dec_op->u4_size
|
||||
>= offsetof(ivd_video_decode_op_t, u4_disp_buf_id)
|
||||
&& ps_dec->ps_out_buffer != NULL)
|
||||
ps_dec->u4_fmt_conv_in_process = 1;
|
||||
else
|
||||
ps_dec->u4_fmt_conv_in_process = 0;
|
||||
|
||||
ps_dec->u4_fmt_conv_cur_row = 0;
|
||||
|
||||
ps_dec->u4_output_present = 0;
|
||||
ps_dec->s_disp_op.u4_error_code = 1;
|
||||
ps_dec->u4_fmt_conv_num_rows = FMT_CONV_NUM_ROWS;
|
||||
ps_dec->u4_stop_threads = 0;
|
||||
if(ps_dec->u4_fmt_conv_in_process && 0 == ps_dec->u4_share_disp_buf
|
||||
if(0 == ps_dec->u4_share_disp_buf
|
||||
&& ps_dec->i4_decode_header == 0)
|
||||
{
|
||||
UWORD32 i;
|
||||
|
|
@ -2799,8 +2800,7 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
|
||||
}
|
||||
|
||||
if(ps_dec->u4_fmt_conv_in_process && ps_dec->u1_flushfrm &&
|
||||
ps_dec->u1_init_dec_flag)
|
||||
if(ps_dec->u1_flushfrm && ps_dec->u1_init_dec_flag)
|
||||
{
|
||||
|
||||
ih264d_get_next_display_field(ps_dec, ps_dec->ps_out_buffer,
|
||||
|
|
@ -2854,24 +2854,21 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
|
||||
ps_dec->u4_prev_nal_skipped = 0;
|
||||
|
||||
ps_dec->u4_start_frame_decode = 0;
|
||||
ps_dec->u2_cur_mb_addr = 0;
|
||||
ps_dec->u2_total_mbs_coded = 0;
|
||||
ps_dec->u2_cur_slice_num = 0;
|
||||
ps_dec->cur_dec_mb_num = 0;
|
||||
ps_dec->cur_recon_mb_num = 0;
|
||||
ps_dec->u4_first_slice_in_pic = 1;
|
||||
ps_dec->u1_slice_header_done = 0;
|
||||
|
||||
ps_dec->u4_dec_thread_created = 0;
|
||||
ps_dec->u4_bs_deblk_thread_created = 0;
|
||||
ps_dec->u4_cur_bs_mb_num = 0;
|
||||
|
||||
ps_dec->as_fmt_conv_part[0].u4_flag = 1;
|
||||
ps_dec->as_fmt_conv_part[1].u4_flag = 1;
|
||||
ps_dec->as_fmt_conv_part[1].u4_start_y = 0;
|
||||
ps_dec->as_fmt_conv_part[1].u4_num_rows_y = 0;
|
||||
|
||||
DEBUG_THREADS_PRINTF(" Starting process call\n");
|
||||
|
||||
ps_dec->u4_pic_buf_got = 0;
|
||||
ps_dec->u2_skip_deblock = 0;
|
||||
|
||||
do
|
||||
{
|
||||
|
|
@ -2891,6 +2888,8 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
|
||||
if(buflen == -1)
|
||||
buflen = 0;
|
||||
/* Ignore bytes beyond the allocated size of intermediate buffer */
|
||||
buflen = MIN(buflen, (WORD32)ps_dec->ps_mem_tab[MEM_REC_BITSBUF].u4_mem_size);
|
||||
|
||||
bytes_consumed = buflen + u4_length_of_start_code;
|
||||
ps_dec_op->u4_num_bytes_consumed += bytes_consumed;
|
||||
|
|
@ -2906,7 +2905,6 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
|
||||
ps_dec_op->e_pic_type = -1;
|
||||
/*signal the decode thread*/
|
||||
ps_dec->as_fmt_conv_part[1].u4_flag = 0;
|
||||
ih264d_signal_decode_thread(ps_dec);
|
||||
/*signal end of frame decode for curren frame*/
|
||||
|
||||
|
|
@ -2962,7 +2960,6 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
ps_dec_op->u4_size =
|
||||
sizeof(ivd_video_decode_op_t);
|
||||
/*signal the decode thread*/
|
||||
ps_dec->as_fmt_conv_part[1].u4_flag = 0;
|
||||
ih264d_signal_decode_thread(ps_dec);
|
||||
/* close deblock thread if it is not closed yet*/
|
||||
if(ps_dec->u4_num_cores == 3)
|
||||
|
|
@ -3017,6 +3014,7 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
else
|
||||
{
|
||||
/* a start code has already been found earlier in the same process call*/
|
||||
frame_data_left = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -3029,13 +3027,18 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
{
|
||||
UWORD32 error = ih264d_map_error(ret);
|
||||
ps_dec_op->u4_error_code = error | ret;
|
||||
api_ret_value = IV_FAIL;
|
||||
|
||||
if((ret == IVD_RES_CHANGED)||(ret == IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED))
|
||||
{
|
||||
/*dont consume the SPS*/
|
||||
ps_dec_op->u4_num_bytes_consumed -= bytes_consumed;
|
||||
return IV_FAIL;
|
||||
}
|
||||
if(ret == ERROR_IN_LAST_SLICE_OF_PIC)
|
||||
{
|
||||
ps_dec_op->u4_num_bytes_consumed -= bytes_consumed;
|
||||
}
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(ps_dec->u4_return_to_app)
|
||||
|
|
@ -3047,7 +3050,6 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
ps_dec_op->u4_frame_decoded_flag = 0;
|
||||
ps_dec_op->u4_size = sizeof(ivd_video_decode_op_t);
|
||||
/*signal the decode thread*/
|
||||
ps_dec->as_fmt_conv_part[1].u4_flag = 0;
|
||||
ih264d_signal_decode_thread(ps_dec);
|
||||
/* close deblock thread if it is not closed yet*/
|
||||
if(ps_dec->u4_num_cores == 3)
|
||||
|
|
@ -3072,73 +3074,56 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
}
|
||||
while(( header_data_left == 1)||(frame_data_left == 1));
|
||||
|
||||
if((ps_dec->u2_total_mbs_coded
|
||||
!= (ps_dec->u2_frm_wd_in_mbs * ps_dec->u2_frm_ht_in_mbs))
|
||||
&& (ps_dec_op->u4_num_bytes_consumed
|
||||
>= ps_dec_ip->u4_num_Bytes))
|
||||
if((ps_dec->u4_slice_start_code_found == 1)
|
||||
&& ps_dec->u2_total_mbs_coded < ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs)
|
||||
{
|
||||
if(ps_dec->ps_parse_cur_slice != NULL)
|
||||
{
|
||||
ps_dec->ps_parse_cur_slice->u2_error_flag = 1;
|
||||
// last slice - missing/corruption
|
||||
WORD32 num_mb_skipped;
|
||||
pocstruct_t temp_poc;
|
||||
|
||||
ps_dec->u2_skip_deblock = 1;
|
||||
}
|
||||
num_mb_skipped = (ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs)
|
||||
- ps_dec->u2_total_mbs_coded;
|
||||
ih264d_mark_err_slice_skip(ps_dec, num_mb_skipped, ps_dec->u1_nal_unit_type == IDR_SLICE_NAL,&temp_poc,3);
|
||||
}
|
||||
|
||||
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
|
||||
/* If Format conversion is not complete,
|
||||
complete it here */
|
||||
if(ps_dec->u4_num_cores == 2)
|
||||
{
|
||||
ps_dec->u4_fmt_conv_num_rows = ps_dec->s_disp_frame_info.u4_y_ht
|
||||
- ps_dec->u4_fmt_conv_cur_row;
|
||||
if(ps_dec->u4_output_present && ps_dec->u4_fmt_conv_in_process
|
||||
&& ps_dec->u4_fmt_conv_num_rows)
|
||||
|
||||
/*do deblocking of all mbs*/
|
||||
if((ps_dec->u4_nmb_deblk == 0) &&(ps_dec->u4_start_recon_deblk == 1) && (ps_dec->ps_cur_sps->u1_mb_aff_flag == 0))
|
||||
{
|
||||
ps_dec->u4_fmt_conv_num_rows = MIN(
|
||||
ps_dec->u4_fmt_conv_num_rows,
|
||||
(ps_dec->s_disp_frame_info.u4_y_ht
|
||||
- ps_dec->u4_fmt_conv_cur_row));
|
||||
if(ps_dec->u4_fmt_conv_num_rows > 64)
|
||||
{
|
||||
UWORD32 num_rows_first_part = (ps_dec->u4_fmt_conv_num_rows
|
||||
/ 2);
|
||||
UWORD32 u4_num_mbs,u4_max_addr;
|
||||
tfr_ctxt_t s_tfr_ctxt;
|
||||
tfr_ctxt_t *ps_tfr_cxt = &s_tfr_ctxt;
|
||||
pad_mgr_t *ps_pad_mgr = &ps_dec->s_pad_mgr;
|
||||
|
||||
/* Align it to even number */
|
||||
num_rows_first_part = (num_rows_first_part >> 1) << 1;
|
||||
/*BS is done for all mbs while parsing*/
|
||||
u4_max_addr = (ps_dec->u2_frm_wd_in_mbs * ps_dec->u2_frm_ht_in_mbs) - 1;
|
||||
ps_dec->u4_cur_bs_mb_num = u4_max_addr + 1;
|
||||
|
||||
/* Schedule last half of the remaining rows to be processed in second thread */
|
||||
ps_dec->as_fmt_conv_part[1].u4_start_y =
|
||||
ps_dec->u4_fmt_conv_cur_row
|
||||
+ num_rows_first_part;
|
||||
ps_dec->as_fmt_conv_part[1].u4_num_rows_y =
|
||||
(ps_dec->u4_fmt_conv_num_rows
|
||||
- num_rows_first_part);
|
||||
ps_dec->u4_fmt_conv_num_rows = num_rows_first_part;
|
||||
DATA_SYNC();
|
||||
ps_dec->as_fmt_conv_part[1].u4_flag = 2;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_dec->as_fmt_conv_part[1].u4_flag = 0;
|
||||
}
|
||||
ih264d_init_deblk_tfr_ctxt(ps_dec, ps_pad_mgr, ps_tfr_cxt,
|
||||
ps_dec->u2_frm_wd_in_mbs, 0);
|
||||
|
||||
ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op),
|
||||
ps_dec->u4_fmt_conv_cur_row,
|
||||
ps_dec->u4_fmt_conv_num_rows);
|
||||
ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
|
||||
|
||||
u4_num_mbs = u4_max_addr
|
||||
- ps_dec->u4_cur_deblk_mb_num + 1;
|
||||
|
||||
DEBUG_PERF_PRINTF("mbs left for deblocking= %d \n",u4_num_mbs);
|
||||
|
||||
if(u4_num_mbs != 0)
|
||||
ih264d_check_mb_map_deblk(ps_dec, u4_num_mbs,
|
||||
ps_tfr_cxt,1);
|
||||
|
||||
ps_dec->u4_start_recon_deblk = 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_dec->as_fmt_conv_part[1].u4_flag = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_dec->as_fmt_conv_part[1].u4_flag = 0;
|
||||
|
||||
}
|
||||
|
||||
/*signal the decode thread*/
|
||||
|
|
@ -3149,9 +3134,10 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
ih264d_signal_bs_deblk_thread(ps_dec);
|
||||
}
|
||||
}
|
||||
/* Decode thread would have completed format conversion for ps_dec->as_fmt_conv_part[1].u4_num_rows_y rows */
|
||||
|
||||
ps_dec->u4_fmt_conv_cur_row += ps_dec->as_fmt_conv_part[1].u4_num_rows_y;
|
||||
|
||||
DATA_SYNC();
|
||||
|
||||
|
||||
if((ps_dec_op->u4_error_code & 0xff)
|
||||
!= ERROR_DYNAMIC_RESOLUTION_NOT_SUPPORTED)
|
||||
|
|
@ -3199,7 +3185,6 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
{
|
||||
ih264d_fill_output_struct_from_context(ps_dec, ps_dec_op);
|
||||
|
||||
ps_dec_op->u4_error_code = ps_dec->i4_error_code;
|
||||
ps_dec_op->u4_frame_decoded_flag = 0;
|
||||
/* close deblock thread if it is not closed yet*/
|
||||
if(ps_dec->u4_num_cores == 3)
|
||||
|
|
@ -3269,7 +3254,7 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
ih264d_signal_bs_deblk_thread(ps_dec);
|
||||
}
|
||||
|
||||
if(ps_dec->u4_fmt_conv_in_process)
|
||||
|
||||
{
|
||||
/* In case the decoder is configured to run in low delay mode,
|
||||
* then get display buffer and then format convert.
|
||||
|
|
@ -3293,15 +3278,11 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
|
||||
/* If Format conversion is not complete,
|
||||
complete it here */
|
||||
ps_dec->u4_fmt_conv_num_rows = ps_dec->s_disp_frame_info.u4_y_ht
|
||||
- ps_dec->u4_fmt_conv_cur_row;
|
||||
DEBUG_PERF_PRINTF("ps_dec->u4_fmt_conv_num_rows = %d\n",ps_dec->u4_fmt_conv_num_rows);
|
||||
if(ps_dec->u4_output_present && ps_dec->u4_fmt_conv_num_rows)
|
||||
if(ps_dec->u4_output_present &&
|
||||
(ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht))
|
||||
{
|
||||
ps_dec->u4_fmt_conv_num_rows = MIN(
|
||||
ps_dec->u4_fmt_conv_num_rows,
|
||||
(ps_dec->s_disp_frame_info.u4_y_ht
|
||||
- ps_dec->u4_fmt_conv_cur_row));
|
||||
ps_dec->u4_fmt_conv_num_rows = ps_dec->s_disp_frame_info.u4_y_ht
|
||||
- ps_dec->u4_fmt_conv_cur_row;
|
||||
ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op),
|
||||
ps_dec->u4_fmt_conv_cur_row,
|
||||
ps_dec->u4_fmt_conv_num_rows);
|
||||
|
|
@ -3314,7 +3295,7 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
if(ps_dec->i4_decode_header == 1 && (ps_dec->i4_header_decoded & 1) == 1)
|
||||
{
|
||||
ps_dec_op->u4_progressive_frame_flag = 1;
|
||||
if((NULL != ps_dec->ps_sps) && (1 == (ps_dec->ps_sps->u1_is_valid)))
|
||||
if((NULL != ps_dec->ps_cur_sps) && (1 == (ps_dec->ps_cur_sps->u1_is_valid)))
|
||||
{
|
||||
if((0 == ps_dec->ps_sps->u1_frame_mbs_only_flag)
|
||||
&& (0 == ps_dec->ps_sps->u1_mb_aff_flag))
|
||||
|
|
@ -3328,12 +3309,13 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
|
||||
H264_DEC_DEBUG_PRINT("The num bytes consumed: %d\n",
|
||||
ps_dec_op->u4_num_bytes_consumed);
|
||||
return IV_SUCCESS;
|
||||
return api_ret_value;
|
||||
}
|
||||
|
||||
WORD32 ih264d_get_version(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
||||
{
|
||||
char version_string[MAXVERSION_STRLEN + 1];
|
||||
UWORD32 version_string_len;
|
||||
|
||||
ivd_ctl_getversioninfo_ip_t *ps_ip;
|
||||
ivd_ctl_getversioninfo_op_t *ps_op;
|
||||
|
|
@ -3352,9 +3334,11 @@ WORD32 ih264d_get_version(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
return (IV_FAIL);
|
||||
}
|
||||
|
||||
if(ps_ip->u4_version_buffer_size >= (strnlen(version_string, MAXVERSION_STRLEN) + 1)) //(WORD32)sizeof(sizeof(version_string)))
|
||||
version_string_len = strnlen(version_string, MAXVERSION_STRLEN) + 1;
|
||||
|
||||
if(ps_ip->u4_version_buffer_size >= version_string_len) //(WORD32)sizeof(sizeof(version_string)))
|
||||
{
|
||||
strncpy(ps_ip->pv_version_buffer, version_string, MAXVERSION_STRLEN);
|
||||
memcpy(ps_ip->pv_version_buffer, version_string, version_string_len);
|
||||
ps_op->u4_error_code = IV_SUCCESS;
|
||||
}
|
||||
else
|
||||
|
|
@ -3389,73 +3373,11 @@ WORD32 ih264d_get_display_frame(iv_obj_t *dec_hdl,
|
|||
void *pv_api_op)
|
||||
{
|
||||
|
||||
ivd_get_display_frame_ip_t *dec_disp_ip;
|
||||
ivd_get_display_frame_op_t *dec_disp_op;
|
||||
|
||||
WORD32 u4_api_ret;
|
||||
dec_struct_t * ps_dec = (dec_struct_t *)(dec_hdl->pv_codec_handle);
|
||||
|
||||
dec_disp_ip = (ivd_get_display_frame_ip_t *)pv_api_ip;
|
||||
dec_disp_op = (ivd_get_display_frame_op_t *)pv_api_op;
|
||||
|
||||
if(ps_dec->u4_fmt_conv_in_process)
|
||||
{
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
if(ps_dec->process_called != 1)
|
||||
{
|
||||
//Return Proper Error Code
|
||||
}
|
||||
|
||||
if(0 == ps_dec->u4_share_disp_buf)
|
||||
{
|
||||
UWORD32 i;
|
||||
if(dec_disp_ip->s_out_buffer.u4_num_bufs == 0)
|
||||
{
|
||||
dec_disp_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
|
||||
dec_disp_op->u4_error_code |= IVD_DISP_FRM_ZERO_OP_BUFS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
for(i = 0; i < dec_disp_ip->s_out_buffer.u4_num_bufs; i++)
|
||||
{
|
||||
if(dec_disp_ip->s_out_buffer.pu1_bufs[i] == NULL)
|
||||
{
|
||||
dec_disp_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
|
||||
dec_disp_op->u4_error_code |= IVD_DISP_FRM_OP_BUF_NULL;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(dec_disp_ip->s_out_buffer.u4_min_out_buf_size[i] == 0)
|
||||
{
|
||||
dec_disp_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
|
||||
dec_disp_op->u4_error_code |= IVD_DISP_FRM_ZERO_OP_BUF_SIZE;
|
||||
return IV_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u4_api_ret = ih264d_get_next_display_field(ps_dec,
|
||||
&(dec_disp_ip->s_out_buffer),
|
||||
&(ps_dec->s_disp_op));
|
||||
*dec_disp_op = (ps_dec->s_disp_op);
|
||||
if(0 == dec_disp_op->u4_error_code)
|
||||
{
|
||||
ps_dec->u4_fmt_conv_cur_row = 0;
|
||||
ps_dec->u4_fmt_conv_num_rows = ps_dec->s_disp_frame_info.u4_y_ht;
|
||||
ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op),
|
||||
ps_dec->u4_fmt_conv_cur_row,
|
||||
ps_dec->u4_fmt_conv_num_rows);
|
||||
ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
|
||||
|
||||
}
|
||||
ih264d_release_display_field(ps_dec, dec_disp_op);
|
||||
return u4_api_ret;
|
||||
}
|
||||
|
||||
UNUSED(dec_hdl);
|
||||
UNUSED(pv_api_ip);
|
||||
UNUSED(pv_api_op);
|
||||
// This function is no longer needed, output is returned in the process()
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -3492,7 +3414,7 @@ WORD32 ih264d_set_display_frame(iv_obj_t *dec_hdl,
|
|||
dec_disp_ip = (ivd_set_display_frame_ip_t *)pv_api_ip;
|
||||
dec_disp_op = (ivd_set_display_frame_op_t *)pv_api_op;
|
||||
dec_disp_op->u4_error_code = 0;
|
||||
if((NULL != ps_dec->ps_sps) && (1 == (ps_dec->ps_sps->u1_is_valid)))
|
||||
if((NULL != ps_dec->ps_cur_sps) && (1 == (ps_dec->ps_cur_sps->u1_is_valid)))
|
||||
{
|
||||
UWORD32 level, width_mbs, height_mbs;
|
||||
|
||||
|
|
@ -3500,10 +3422,10 @@ WORD32 ih264d_set_display_frame(iv_obj_t *dec_hdl,
|
|||
width_mbs = ps_dec->u2_frm_wd_in_mbs;
|
||||
height_mbs = ps_dec->u2_frm_ht_in_mbs;
|
||||
|
||||
if((ps_dec->ps_sps->u1_vui_parameters_present_flag == 1)
|
||||
&& (ps_dec->ps_sps->s_vui.u4_num_reorder_frames != 64))
|
||||
if((ps_dec->ps_cur_sps->u1_vui_parameters_present_flag == 1)
|
||||
&& (ps_dec->ps_cur_sps->s_vui.u4_num_reorder_frames != 64))
|
||||
{
|
||||
num_mvbank_req = ps_dec->ps_sps->s_vui.u4_num_reorder_frames + 2;
|
||||
num_mvbank_req = ps_dec->ps_cur_sps->s_vui.u4_num_reorder_frames + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3513,7 +3435,7 @@ WORD32 ih264d_set_display_frame(iv_obj_t *dec_hdl,
|
|||
height_mbs);
|
||||
}
|
||||
|
||||
num_mvbank_req += ps_dec->ps_sps->u1_num_ref_frames + 1;
|
||||
num_mvbank_req += ps_dec->ps_cur_sps->u1_num_ref_frames + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3613,9 +3535,13 @@ WORD32 ih264d_set_flush_mode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op
|
|||
/* Signal flush frame control call */
|
||||
ps_dec->u1_flushfrm = 1;
|
||||
|
||||
if( ps_dec->u1_init_dec_flag == 1)
|
||||
{
|
||||
|
||||
ih264d_release_pics_in_dpb((void *)ps_dec,
|
||||
ps_dec->u1_pic_bufs);
|
||||
ih264d_release_display_bufs(ps_dec);
|
||||
}
|
||||
|
||||
ps_ctl_op->u4_error_code =
|
||||
((ivd_ctl_flush_op_t*)ps_dec->pv_dec_out)->u4_error_code; //verify the value
|
||||
|
|
@ -3661,7 +3587,7 @@ WORD32 ih264d_get_status(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
pic_wd = ps_dec->u4_width_at_init;
|
||||
pic_ht = ps_dec->u4_height_at_init;
|
||||
|
||||
if((NULL != ps_dec->ps_sps) && (1 == (ps_dec->ps_sps->u1_is_valid)))
|
||||
if((NULL != ps_dec->ps_cur_sps) && (1 == (ps_dec->ps_cur_sps->u1_is_valid)))
|
||||
{
|
||||
ps_ctl_op->u4_pic_ht = ps_dec->u2_disp_height;
|
||||
ps_ctl_op->u4_pic_wd = ps_dec->u2_disp_width;
|
||||
|
|
@ -3698,7 +3624,7 @@ WORD32 ih264d_get_status(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
ps_ctl_op->u4_num_disp_bufs = 1;
|
||||
else
|
||||
{
|
||||
if((NULL != ps_dec->ps_sps) && (1 == (ps_dec->ps_sps->u1_is_valid)))
|
||||
if((NULL != ps_dec->ps_cur_sps) && (1 == (ps_dec->ps_cur_sps->u1_is_valid)))
|
||||
{
|
||||
UWORD32 level, width_mbs, height_mbs;
|
||||
|
||||
|
|
@ -3706,12 +3632,12 @@ WORD32 ih264d_get_status(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
width_mbs = ps_dec->u2_frm_wd_in_mbs;
|
||||
height_mbs = ps_dec->u2_frm_ht_in_mbs;
|
||||
|
||||
if((ps_dec->ps_sps->u1_vui_parameters_present_flag == 1)
|
||||
&& (ps_dec->ps_sps->s_vui.u4_num_reorder_frames
|
||||
if((ps_dec->ps_cur_sps->u1_vui_parameters_present_flag == 1)
|
||||
&& (ps_dec->ps_cur_sps->s_vui.u4_num_reorder_frames
|
||||
!= 64))
|
||||
{
|
||||
ps_ctl_op->u4_num_disp_bufs =
|
||||
ps_dec->ps_sps->s_vui.u4_num_reorder_frames + 2;
|
||||
ps_dec->ps_cur_sps->s_vui.u4_num_reorder_frames + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3722,7 +3648,7 @@ WORD32 ih264d_get_status(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
}
|
||||
|
||||
ps_ctl_op->u4_num_disp_bufs +=
|
||||
ps_dec->ps_sps->u1_num_ref_frames + 1;
|
||||
ps_dec->ps_cur_sps->u1_num_ref_frames + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3882,7 +3808,7 @@ WORD32 ih264d_get_buf_info(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
pic_wd = ps_dec->u4_width_at_init;
|
||||
pic_ht = ps_dec->u4_height_at_init;
|
||||
|
||||
if((NULL != ps_dec->ps_sps) && (1 == (ps_dec->ps_sps->u1_is_valid)))
|
||||
if((NULL != ps_dec->ps_cur_sps) && (1 == (ps_dec->ps_cur_sps->u1_is_valid)))
|
||||
{
|
||||
|
||||
if(0 == ps_dec->u4_share_disp_buf)
|
||||
|
|
@ -3896,6 +3822,7 @@ WORD32 ih264d_get_buf_info(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
pic_wd = ps_dec->u2_frm_wd_y;
|
||||
pic_ht = ps_dec->u2_frm_ht_y;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3914,7 +3841,7 @@ WORD32 ih264d_get_buf_info(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
ps_ctl_op->u4_num_disp_bufs = 1;
|
||||
else
|
||||
{
|
||||
if((NULL != ps_dec->ps_sps) && (1 == (ps_dec->ps_sps->u1_is_valid)))
|
||||
if((NULL != ps_dec->ps_cur_sps) && (1 == (ps_dec->ps_cur_sps->u1_is_valid)))
|
||||
{
|
||||
UWORD32 level, width_mbs, height_mbs;
|
||||
|
||||
|
|
@ -3922,12 +3849,12 @@ WORD32 ih264d_get_buf_info(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
width_mbs = ps_dec->u2_frm_wd_in_mbs;
|
||||
height_mbs = ps_dec->u2_frm_ht_in_mbs;
|
||||
|
||||
if((ps_dec->ps_sps->u1_vui_parameters_present_flag == 1)
|
||||
&& (ps_dec->ps_sps->s_vui.u4_num_reorder_frames
|
||||
if((ps_dec->ps_cur_sps->u1_vui_parameters_present_flag == 1)
|
||||
&& (ps_dec->ps_cur_sps->s_vui.u4_num_reorder_frames
|
||||
!= 64))
|
||||
{
|
||||
ps_ctl_op->u4_num_disp_bufs =
|
||||
ps_dec->ps_sps->s_vui.u4_num_reorder_frames + 2;
|
||||
ps_dec->ps_cur_sps->s_vui.u4_num_reorder_frames + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3938,7 +3865,7 @@ WORD32 ih264d_get_buf_info(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
}
|
||||
|
||||
ps_ctl_op->u4_num_disp_bufs +=
|
||||
ps_dec->ps_sps->u1_num_ref_frames + 1;
|
||||
ps_dec->ps_cur_sps->u1_num_ref_frames + 1;
|
||||
|
||||
}
|
||||
else
|
||||
|
|
@ -4426,7 +4353,7 @@ WORD32 ih264d_get_frame_dimensions(iv_obj_t *dec_hdl,
|
|||
|
||||
ps_op = (ih264d_ctl_get_frame_dimensions_op_t *)pv_api_op;
|
||||
UNUSED(ps_ip);
|
||||
if((NULL != ps_dec->ps_sps) && (1 == (ps_dec->ps_sps->u1_is_valid)))
|
||||
if((NULL != ps_dec->ps_cur_sps) && (1 == (ps_dec->ps_cur_sps->u1_is_valid)))
|
||||
{
|
||||
disp_wd = ps_dec->u2_disp_width;
|
||||
disp_ht = ps_dec->u2_disp_height;
|
||||
|
|
@ -4444,7 +4371,6 @@ WORD32 ih264d_get_frame_dimensions(iv_obj_t *dec_hdl,
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
disp_wd = ps_dec->u4_width_at_init;
|
||||
disp_ht = ps_dec->u4_height_at_init;
|
||||
|
||||
|
|
@ -4457,7 +4383,6 @@ WORD32 ih264d_get_frame_dimensions(iv_obj_t *dec_hdl,
|
|||
{
|
||||
buffer_wd = ALIGN16(disp_wd) + (PAD_LEN_Y_H << 1);
|
||||
buffer_ht = ALIGN16(disp_ht) + (PAD_LEN_Y_V << 2);
|
||||
|
||||
}
|
||||
}
|
||||
if(ps_dec->u4_app_disp_width > buffer_wd)
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
#include "ih264_macros.h"
|
||||
#include "ih264_platform_macros.h"
|
||||
#include "ih264d_cabac.h"
|
||||
#include "ih264d_tables.h"
|
||||
|
||||
/*combined table :guc_RTAB,NextStateLPS,NextStateMPS
|
||||
input(combined_state):
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -42,6 +42,10 @@ WORD8 ih264d_set_deblocking_parameters(deblk_mb_t * ps_cur_deblk_mb,
|
|||
UWORD8 u1_mb_ngbr_availablity,
|
||||
UWORD8 u1_mb_field_decoding_flag);
|
||||
|
||||
void ih264d_copy_intra_pred_line(dec_struct_t *ps_dec,
|
||||
dec_mb_info_t *ps_cur_mb_info,
|
||||
UWORD32 nmb_index);
|
||||
|
||||
void FilterBoundaryLeft(tfr_ctxt_t * const ps_tfr_cxt,
|
||||
const WORD8 i1_cb_qp_idx_ofst,
|
||||
const WORD8 i1_cr_qp_idx_ofst,
|
||||
|
|
@ -154,11 +158,8 @@ void ih264d_deblock_mb_nonmbaff(dec_struct_t *ps_dec,
|
|||
tfr_ctxt_t * const ps_tfr_cxt,
|
||||
const WORD8 i1_cb_qp_idx_ofst,
|
||||
const WORD8 i1_cr_qp_idx_ofst,
|
||||
deblk_mb_t * const ps_cur_mb,
|
||||
WORD32 i4_strd_y,
|
||||
WORD32 i4_strd_uv,
|
||||
deblk_mb_t * const ps_top_mb,
|
||||
deblk_mb_t * const ps_left_mb);
|
||||
WORD32 i4_strd_uv);
|
||||
|
||||
void ih264d_init_deblk_tfr_ctxt(dec_struct_t * ps_dec,
|
||||
pad_mgr_t *ps_pad_mgr,
|
||||
|
|
|
|||
|
|
@ -35,26 +35,12 @@
|
|||
************************************************************************
|
||||
*/
|
||||
#define H264_MAX_FRAME_WIDTH 3840
|
||||
#define H264_MAX_FRAME_HEIGHT 2160
|
||||
#define H264_MAX_FRAME_HEIGHT 2176
|
||||
|
||||
#define H264_MIN_FRAME_WIDTH 16
|
||||
#define H264_MIN_FRAME_HEIGHT 16
|
||||
|
||||
#define IH264DEC_MAX_NAL_UNIT_SIZE 311040
|
||||
#define IH264DEC_NUM_ZEROS_IN_START_CODE 2
|
||||
#define H264DEC_MEM_ALLOC_SUCCESS 1
|
||||
#define H264DEC_MEM_ALLOC_FAILURE 0
|
||||
#define H264DEC_CREATE_FAILED (NULL)
|
||||
|
||||
#define H264_NO_BUF_TO_DISPLAY -1
|
||||
#define H264_DISPLAY_BUF_FOUND 0
|
||||
#define IH264DEC_YUV420 0
|
||||
#define IH264DEC_YUV422 1
|
||||
#define IH264DEC_YUV422INTERLACED 2
|
||||
#define IH264DEC_RGB 4 // Original Size
|
||||
/* Ceiling of variables to the nearest power of 2 */
|
||||
#define FILL_POWEROF2(x,y) (size_t)(((x) & ((1<<(y))-1))?((1<<(y)) - ((x) & ((1<<(y))-1))): 0)
|
||||
#define ALIGN_POWEROF2(x,y) (x) = (x)+FILL_POWEROF2((size_t)(x),y)
|
||||
#define FMT_CONV_NUM_ROWS 16
|
||||
|
||||
/** Bit manipulation macros */
|
||||
#define CHECKBIT(a,i) ((a) & (1 << i))
|
||||
|
|
@ -78,10 +64,10 @@
|
|||
#define MAX_REF_BUFS 32
|
||||
#define MAX_DISP_BUFS_NEW 64
|
||||
#define MAX_FRAMES 16
|
||||
#define MAX_MBS_IN_ROW (720/16)
|
||||
|
||||
#define INVALID_FRAME_NUM 0x0fffffff
|
||||
#define GAP_FRAME_NUM 0x1fffffff
|
||||
#define MAX_PIC_SIZE 622080 // 720 * 576 * 1.5
|
||||
|
||||
/** macros for reference picture lists, refIdx to POC mapping */
|
||||
// 1 extra entry into reference picture lists for refIdx = -1.
|
||||
// this entry is always 0. this saves conditional checks in
|
||||
|
|
@ -112,7 +98,7 @@
|
|||
#define INT_PIC_TYPE_I (0x00)
|
||||
|
||||
#define YIELD_CNT_THRESHOLD 8
|
||||
#define ENABLE_420P_UV_SHARING 1
|
||||
|
||||
|
||||
#define OK 0
|
||||
#define END 1
|
||||
|
|
@ -272,7 +258,7 @@ enum
|
|||
#define BASE_PROFILE_IDC 66
|
||||
#define MAIN_PROFILE_IDC 77
|
||||
#define HIGH_PROFILE_IDC 100
|
||||
#define MAIN_PROFILE 1
|
||||
|
||||
|
||||
#define MB_SIZE 16
|
||||
#define BLK8x8SIZE 8
|
||||
|
|
@ -640,27 +626,17 @@ enum
|
|||
#define MASK_PRED_WEIGHT_OFFSET 0xFFFFFF00
|
||||
#define MAX_REDUNDANT_PIC_CNT 127
|
||||
|
||||
#define DPB_HACK 0
|
||||
#define DPB_HACK_NEW 0
|
||||
|
||||
|
||||
|
||||
#define PD_MB_BUF_SIZE (H264_MAX_FRAME_WIDTH * H264_MAX_FRAME_WIDTH / 256)
|
||||
#define PD_MB_BUF_SIZE_MOD 0xffffffff
|
||||
#define MAX_PRED_INFO_LIMIT (PD_MB_BUF_SIZE * 32 * 2)
|
||||
|
||||
#endif //DEBLOCK_THREAD
|
||||
|
||||
|
||||
#define NO_DC_SB 0
|
||||
#define SUB_BLK_MASK 0xFFFFFF00
|
||||
#define NUM_COEFFS_IN_4x4BLK 16
|
||||
|
||||
|
||||
#define MEMSET_16BYTES(pu4_start,value) \
|
||||
{ \
|
||||
memset(pu4_start,value,16); \
|
||||
}
|
||||
{ \
|
||||
memset(pu4_start,value,16); \
|
||||
}
|
||||
|
||||
#define MEMCPY_16BYTES(dst,src) \
|
||||
{ \
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "ih264_typedefs.h"
|
||||
#include "ih264_macros.h"
|
||||
#include "ih264_platform_macros.h"
|
||||
#include "ih264d_structs.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
@ -109,7 +110,14 @@ typedef enum
|
|||
ERROR_LEVEL_UNSUPPORTED = 0x90,
|
||||
ERROR_START_CODE_NOT_FOUND = 0x91,
|
||||
ERROR_PIC_NUM_IS_REPEATED = 0x92,
|
||||
ERROR_IN_LAST_SLICE_OF_PIC = 0x93
|
||||
|
||||
} h264_decoder_error_code_t;
|
||||
|
||||
WORD32 ih264d_mark_err_slice_skip(dec_struct_t * ps_dec,
|
||||
WORD32 num_mb_skip,
|
||||
UWORD8 u1_is_idr_slice,
|
||||
pocstruct_t *ps_cur_poc,
|
||||
WORD32 prev_slice_err);
|
||||
|
||||
#endif /* _IH264D_ERROR_HANDLER_H_ */
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#include <string.h>
|
||||
/* User include files */
|
||||
#include "ih264_typedefs.h"
|
||||
#include "iv.h"
|
||||
#include "ih264_macros.h"
|
||||
#include "ih264_platform_macros.h"
|
||||
#include "ih264d_structs.h"
|
||||
|
|
@ -647,7 +648,7 @@ void ih264d_fmt_conv_420sp_to_420p(UWORD8 *pu1_y_src,
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Function Name : ih264d_format_convert */
|
||||
/* Function Name : ih264d_format_convert */
|
||||
/* */
|
||||
/* Description : Implements format conversion/frame copy */
|
||||
/* Inputs : ps_dec - Decoder parameters */
|
||||
|
|
@ -671,6 +672,8 @@ void ih264d_format_convert(dec_struct_t *ps_dec,
|
|||
{
|
||||
UWORD32 convert_uv_only = 0;
|
||||
iv_yuv_buf_t *ps_op_frm;
|
||||
UWORD8 *pu1_y_src, *pu1_uv_src;
|
||||
UWORD32 start_uv = u4_start_y >> 1;
|
||||
|
||||
if(1 == pv_disp_op->u4_error_code)
|
||||
return;
|
||||
|
|
@ -680,25 +683,26 @@ void ih264d_format_convert(dec_struct_t *ps_dec,
|
|||
/* Requires u4_start_y and u4_num_rows_y to be even */
|
||||
if(u4_start_y & 1)
|
||||
{
|
||||
H264_DEC_DEBUG_PRINT(
|
||||
"Requires even number of rows and even u4_start_y for format conversion\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if((1 == ps_dec->u4_share_disp_buf)
|
||||
&& ((pv_disp_op->e_output_format == IV_YUV_420SP_UV)))
|
||||
if((1 == ps_dec->u4_share_disp_buf) &&
|
||||
(pv_disp_op->e_output_format == IV_YUV_420SP_UV))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pu1_y_src = (UWORD8 *)ps_op_frm->pv_y_buf;
|
||||
pu1_y_src += u4_start_y * ps_op_frm->u4_y_strd,
|
||||
|
||||
pu1_uv_src = (UWORD8 *)ps_op_frm->pv_u_buf;
|
||||
pu1_uv_src += start_uv * ps_op_frm->u4_u_strd;
|
||||
|
||||
if(pv_disp_op->e_output_format == IV_YUV_420P)
|
||||
{
|
||||
UWORD8 *pu1_src, *pu1_dst;
|
||||
UWORD16 i;
|
||||
UWORD16 iter;
|
||||
|
||||
UWORD8 *pu1_y_dst, *pu1_u_dst, *pu1_v_dst;
|
||||
IV_COLOR_FORMAT_T e_output_format = pv_disp_op->e_output_format;
|
||||
UWORD32 start_uv = u4_start_y >> 1;
|
||||
UWORD32 num_rows_uv = (u4_num_rows_y + 1) >> 1;
|
||||
|
||||
if(0 == ps_dec->u4_share_disp_buf)
|
||||
{
|
||||
convert_uv_only = 0;
|
||||
|
|
@ -707,118 +711,85 @@ void ih264d_format_convert(dec_struct_t *ps_dec,
|
|||
{
|
||||
convert_uv_only = 1;
|
||||
}
|
||||
{
|
||||
|
||||
UWORD8 *pu1_y_src, *pu1_u_src, *pu1_v_src;
|
||||
UWORD8 *pu1_y_dst, *pu1_u_dst, *pu1_v_dst;
|
||||
UWORD32 width, height;
|
||||
UWORD32 src_luma_stride, src_chroma_stride;
|
||||
UWORD32 dst_luma_stride, dst_chroma_stride;
|
||||
pu1_y_dst = (UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_y_buf;
|
||||
pu1_y_dst += u4_start_y * pv_disp_op->s_disp_frm_buf.u4_y_strd;
|
||||
|
||||
pu1_y_src = (UWORD8 *)ps_op_frm->pv_y_buf;
|
||||
pu1_y_src += u4_start_y * ps_op_frm->u4_y_strd;
|
||||
pu1_u_dst = (UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_u_buf;
|
||||
pu1_u_dst += start_uv * pv_disp_op->s_disp_frm_buf.u4_u_strd;
|
||||
|
||||
pu1_y_dst = (UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_y_buf;
|
||||
pu1_y_dst += u4_start_y * pv_disp_op->s_disp_frm_buf.u4_y_strd;
|
||||
pu1_v_dst = (UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_v_buf;
|
||||
pu1_v_dst += start_uv * pv_disp_op->s_disp_frm_buf.u4_v_strd;
|
||||
|
||||
pu1_u_src = (UWORD8 *)ps_op_frm->pv_u_buf;
|
||||
pu1_u_src += start_uv * ps_op_frm->u4_u_strd;
|
||||
|
||||
pu1_u_dst = (UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_u_buf;
|
||||
pu1_u_dst += start_uv * pv_disp_op->s_disp_frm_buf.u4_u_strd;
|
||||
|
||||
pu1_v_src = (UWORD8 *)ps_op_frm->pv_v_buf;
|
||||
pu1_v_src += start_uv * ps_op_frm->u4_v_strd;
|
||||
|
||||
pu1_v_dst = (UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_v_buf;
|
||||
pu1_v_dst += start_uv * pv_disp_op->s_disp_frm_buf.u4_v_strd;
|
||||
|
||||
src_luma_stride = ps_op_frm->u4_y_strd;
|
||||
src_chroma_stride = ps_op_frm->u4_u_strd;
|
||||
|
||||
dst_luma_stride = pv_disp_op->s_disp_frm_buf.u4_y_strd;
|
||||
dst_chroma_stride = pv_disp_op->s_disp_frm_buf.u4_u_strd;
|
||||
|
||||
width = ps_op_frm->u4_y_wd;
|
||||
height = u4_num_rows_y;
|
||||
ih264d_fmt_conv_420sp_to_420p(pu1_y_src, pu1_u_src, pu1_y_dst,
|
||||
pu1_u_dst, pu1_v_dst, width, height,
|
||||
src_luma_stride, src_chroma_stride,
|
||||
dst_luma_stride, dst_chroma_stride, 1,
|
||||
convert_uv_only);
|
||||
}
|
||||
ih264d_fmt_conv_420sp_to_420p(pu1_y_src,
|
||||
pu1_uv_src,
|
||||
pu1_y_dst,
|
||||
pu1_u_dst,
|
||||
pu1_v_dst,
|
||||
ps_op_frm->u4_y_wd,
|
||||
u4_num_rows_y,
|
||||
ps_op_frm->u4_y_strd,
|
||||
ps_op_frm->u4_u_strd,
|
||||
pv_disp_op->s_disp_frm_buf.u4_y_strd,
|
||||
pv_disp_op->s_disp_frm_buf.u4_u_strd,
|
||||
1,
|
||||
convert_uv_only);
|
||||
|
||||
}
|
||||
|
||||
else if((pv_disp_op->e_output_format == IV_YUV_420SP_UV)
|
||||
|| (pv_disp_op->e_output_format == IV_YUV_420SP_VU))
|
||||
|
||||
else if((pv_disp_op->e_output_format == IV_YUV_420SP_UV) ||
|
||||
(pv_disp_op->e_output_format == IV_YUV_420SP_VU))
|
||||
{
|
||||
UWORD8* pu1_y_dst, *pu1_uv_dst;
|
||||
|
||||
UWORD32 start_uv = u4_start_y >> 1;
|
||||
UWORD32 num_rows_uv = (u4_num_rows_y + 1) >> 1;
|
||||
pu1_y_dst = (UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_y_buf;
|
||||
pu1_y_dst += u4_start_y * pv_disp_op->s_disp_frm_buf.u4_y_strd;
|
||||
|
||||
pu1_uv_dst = (UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_u_buf;
|
||||
pu1_uv_dst += start_uv * pv_disp_op->s_disp_frm_buf.u4_u_strd;
|
||||
|
||||
if(pv_disp_op->e_output_format == IV_YUV_420SP_UV)
|
||||
{
|
||||
ih264d_fmt_conv_420sp_to_420sp(
|
||||
(UWORD8 *)ps_op_frm->pv_y_buf
|
||||
+ u4_start_y * ps_op_frm->u4_y_strd,
|
||||
((UWORD8 *)ps_op_frm->pv_u_buf
|
||||
+ start_uv * ps_op_frm->u4_u_strd),
|
||||
((UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_y_buf
|
||||
+ u4_start_y
|
||||
* pv_disp_op->s_disp_frm_buf.u4_y_strd),
|
||||
((UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_u_buf
|
||||
+ start_uv
|
||||
* pv_disp_op->s_disp_frm_buf.u4_u_strd),
|
||||
ps_op_frm->u4_y_wd, u4_num_rows_y,
|
||||
ps_op_frm->u4_y_strd, ps_op_frm->u4_u_strd,
|
||||
pv_disp_op->s_disp_frm_buf.u4_y_strd,
|
||||
pv_disp_op->s_disp_frm_buf.u4_u_strd);
|
||||
ih264d_fmt_conv_420sp_to_420sp(pu1_y_src,
|
||||
pu1_uv_src,
|
||||
pu1_y_dst,
|
||||
pu1_uv_dst,
|
||||
ps_op_frm->u4_y_wd,
|
||||
u4_num_rows_y,
|
||||
ps_op_frm->u4_y_strd,
|
||||
ps_op_frm->u4_u_strd,
|
||||
pv_disp_op->s_disp_frm_buf.u4_y_strd,
|
||||
pv_disp_op->s_disp_frm_buf.u4_u_strd);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ih264d_fmt_conv_420sp_to_420sp_swap_uv(
|
||||
(UWORD8 *)ps_op_frm->pv_y_buf
|
||||
+ u4_start_y * ps_op_frm->u4_y_strd,
|
||||
((UWORD8 *)ps_op_frm->pv_u_buf
|
||||
+ start_uv * ps_op_frm->u4_u_strd),
|
||||
((UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_y_buf
|
||||
+ u4_start_y
|
||||
* pv_disp_op->s_disp_frm_buf.u4_y_strd),
|
||||
((UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_u_buf
|
||||
+ start_uv
|
||||
* pv_disp_op->s_disp_frm_buf.u4_u_strd),
|
||||
ps_op_frm->u4_y_wd, u4_num_rows_y,
|
||||
ps_op_frm->u4_y_strd, ps_op_frm->u4_u_strd,
|
||||
pv_disp_op->s_disp_frm_buf.u4_y_strd,
|
||||
pv_disp_op->s_disp_frm_buf.u4_u_strd);
|
||||
|
||||
ih264d_fmt_conv_420sp_to_420sp_swap_uv(pu1_y_src,
|
||||
pu1_uv_src,
|
||||
pu1_y_dst,
|
||||
pu1_uv_dst,
|
||||
ps_op_frm->u4_y_wd,
|
||||
u4_num_rows_y,
|
||||
ps_op_frm->u4_y_strd,
|
||||
ps_op_frm->u4_u_strd,
|
||||
pv_disp_op->s_disp_frm_buf.u4_y_strd,
|
||||
pv_disp_op->s_disp_frm_buf.u4_u_strd);
|
||||
}
|
||||
|
||||
}
|
||||
else if(pv_disp_op->e_output_format == IV_RGB_565)
|
||||
{
|
||||
UWORD32 temp = 0;
|
||||
UWORD32 u2_width_rem;
|
||||
|
||||
UWORD32 start_uv = u4_start_y >> 1;
|
||||
|
||||
ih264d_fmt_conv_420sp_to_rgb565(
|
||||
(UWORD8 *)ps_op_frm->pv_y_buf
|
||||
+ u4_start_y * ps_op_frm->u4_y_strd,
|
||||
((UWORD8 *)ps_op_frm->pv_u_buf
|
||||
+ start_uv * ps_op_frm->u4_u_strd),
|
||||
((UWORD16 *)pv_disp_op->s_disp_frm_buf.pv_y_buf
|
||||
+ u4_start_y
|
||||
* pv_disp_op->s_disp_frm_buf.u4_y_strd),
|
||||
ps_op_frm->u4_y_wd, u4_num_rows_y, ps_op_frm->u4_y_strd,
|
||||
ps_op_frm->u4_u_strd,
|
||||
pv_disp_op->s_disp_frm_buf.u4_y_strd, 1);
|
||||
UWORD16 *pu2_rgb_dst;
|
||||
|
||||
pu2_rgb_dst = (UWORD16 *)pv_disp_op->s_disp_frm_buf.pv_y_buf;
|
||||
pu2_rgb_dst += u4_start_y * pv_disp_op->s_disp_frm_buf.u4_y_strd;
|
||||
|
||||
ih264d_fmt_conv_420sp_to_rgb565(pu1_y_src,
|
||||
pu1_uv_src,
|
||||
pu2_rgb_dst,
|
||||
ps_op_frm->u4_y_wd,
|
||||
u4_num_rows_y,
|
||||
ps_op_frm->u4_y_strd,
|
||||
ps_op_frm->u4_u_strd,
|
||||
pv_disp_op->s_disp_frm_buf.u4_y_strd,
|
||||
1);
|
||||
}
|
||||
|
||||
if((u4_start_y + u4_num_rows_y) >= ps_dec->s_disp_frame_info.u4_y_ht)
|
||||
|
|
@ -826,7 +797,8 @@ void ih264d_format_convert(dec_struct_t *ps_dec,
|
|||
|
||||
INSERT_LOGO(pv_disp_op->s_disp_frm_buf.pv_y_buf,
|
||||
pv_disp_op->s_disp_frm_buf.pv_u_buf,
|
||||
pv_disp_op->s_disp_frm_buf.pv_v_buf, pv_disp_op->s_disp_frm_buf.u4_y_strd,
|
||||
pv_disp_op->s_disp_frm_buf.pv_v_buf,
|
||||
pv_disp_op->s_disp_frm_buf.u4_y_strd,
|
||||
ps_dec->u2_disp_width,
|
||||
ps_dec->u2_disp_height,
|
||||
pv_disp_op->e_output_format,
|
||||
|
|
|
|||
|
|
@ -188,8 +188,6 @@ WORD32 ih264d_form_mb_part_info_bp(pred_info_pkd_t *ps_pred_pkd,
|
|||
UWORD8 u1_part_wd = 0,u1_part_ht = 0;
|
||||
WORD16 i2_mv_x,i2_mv_y;
|
||||
|
||||
|
||||
|
||||
/********************************************/
|
||||
/* i1_mc_wd width reqd for mcomp */
|
||||
/* u1_dma_ht height reqd for mcomp */
|
||||
|
|
@ -197,7 +195,6 @@ WORD32 ih264d_form_mb_part_info_bp(pred_info_pkd_t *ps_pred_pkd,
|
|||
/* u1_dx fractional part of width */
|
||||
/* u1_dx fractional part of height */
|
||||
/********************************************/
|
||||
WORD32 u1_ofst_in_word;
|
||||
UWORD32 i1_mc_wd;
|
||||
|
||||
WORD32 u1_dma_ht;
|
||||
|
|
@ -276,15 +273,12 @@ WORD32 ih264d_form_mb_part_info_bp(pred_info_pkd_t *ps_pred_pkd,
|
|||
|
||||
pu1_pred = ps_ref_frm->pu1_buf1 + i2_frm_y * u2_frm_wd + i2_frm_x;
|
||||
|
||||
|
||||
u1_ofst_in_word = 0;
|
||||
u1_dma_wd = (i1_mc_wd + u1_ofst_in_word + 3) & 0xFC;
|
||||
u1_dma_wd = (i1_mc_wd + 3) & 0xFC;
|
||||
|
||||
/********************************************************************/
|
||||
/* Calulating the horizontal and the vertical u4_ofst from top left */
|
||||
/* edge of the recon buffer */
|
||||
/********************************************************************/
|
||||
/* CHANGED CODE */
|
||||
u2_rec_wd = MB_SIZE;
|
||||
{
|
||||
u2_rec_wd = ps_dec->u2_frm_wd_y;
|
||||
|
|
@ -293,8 +287,6 @@ WORD32 ih264d_form_mb_part_info_bp(pred_info_pkd_t *ps_pred_pkd,
|
|||
+ i2_rec_x;
|
||||
}
|
||||
|
||||
/* CHANGED CODE */
|
||||
|
||||
/* filling the pred and dma structures for Y */
|
||||
u2_frm_wd = ps_dec->u2_frm_wd_y;
|
||||
|
||||
|
|
@ -307,7 +299,6 @@ WORD32 ih264d_form_mb_part_info_bp(pred_info_pkd_t *ps_pred_pkd,
|
|||
|
||||
ps_pred->i1_mb_partwidth = u1_part_wd << 2;
|
||||
ps_pred->i1_mb_partheight = u1_part_ht << 2;
|
||||
ps_pred->u1_mc_addr_ofst = u1_ofst_in_word;
|
||||
ps_pred->u1_dydx = (u1_dy << 2) + u1_dx;
|
||||
|
||||
ps_pred->pu1_y_ref = pu1_pred;
|
||||
|
|
@ -374,9 +365,7 @@ WORD32 ih264d_form_mb_part_info_bp(pred_info_pkd_t *ps_pred_pkd,
|
|||
i2_frm_y = CLIP3(((1 - u1_dma_ht)), (u2_pic_ht - (1)), i2_frm_y);
|
||||
|
||||
i4_ref_offset = i2_frm_y * u2_frm_wd + i2_frm_x * YUV420SP_FACTOR;
|
||||
u1_ofst_in_word = 0;
|
||||
u1_dma_wd = (i1_mc_wd + u1_ofst_in_word + 3) & 0xFC;
|
||||
i4_ref_offset -= u1_ofst_in_word;
|
||||
u1_dma_wd = (i1_mc_wd + 3) & 0xFC;
|
||||
|
||||
/********************************************************************/
|
||||
/* Calulating the horizontal and the vertical u4_ofst from top left */
|
||||
|
|
@ -409,7 +398,6 @@ WORD32 ih264d_form_mb_part_info_bp(pred_info_pkd_t *ps_pred_pkd,
|
|||
|
||||
ps_pred->i1_mb_partwidth = u1_part_wd << 1;
|
||||
ps_pred->i1_mb_partheight = u1_part_ht << 1;
|
||||
ps_pred->u1_mc_addr_ofst = u1_ofst_in_word;
|
||||
ps_pred->u1_dydx = (u1_dy << 3) + u1_dx;
|
||||
|
||||
pu1_pred_u = ps_ref_frm->pu1_buf2 + i4_ref_offset;
|
||||
|
|
@ -483,7 +471,7 @@ WORD32 ih264d_form_mb_part_info_mp(pred_info_pkd_t *ps_pred_pkd,
|
|||
/* u1_dx fractional part of width */
|
||||
/* u1_dx fractional part of height */
|
||||
/********************************************/
|
||||
UWORD8 u1_ofst_in_word, i1_mc_wd, u1_dma_ht, u1_dma_wd, u1_dx, u1_dy;
|
||||
UWORD8 i1_mc_wd, u1_dma_ht, u1_dma_wd, u1_dx, u1_dy;
|
||||
pred_info_t * ps_pred ;
|
||||
dec_slice_params_t * const ps_cur_slice = ps_dec->ps_cur_slice;
|
||||
const UWORD8 u1_slice_type = ps_cur_slice->u1_slice_type;
|
||||
|
|
@ -639,10 +627,7 @@ WORD32 ih264d_form_mb_part_info_mp(pred_info_pkd_t *ps_pred_pkd,
|
|||
(u2_pic_ht - (1 << u1_mb_fld)), i2_frm_y);
|
||||
|
||||
pu1_pred = pu1_buf1 + i2_frm_y * u2_frm_wd + i2_frm_x;
|
||||
u1_ofst_in_word = 0;
|
||||
|
||||
u1_dma_wd = (i1_mc_wd + u1_ofst_in_word + 3) & 0xFC;
|
||||
|
||||
u1_dma_wd = (i1_mc_wd + 3) & 0xFC;
|
||||
/********************************************************************/
|
||||
/* Calulating the horizontal and the vertical u4_ofst from top left */
|
||||
/* edge of the recon buffer */
|
||||
|
|
@ -675,7 +660,6 @@ WORD32 ih264d_form_mb_part_info_mp(pred_info_pkd_t *ps_pred_pkd,
|
|||
|
||||
ps_pred->i1_mb_partwidth = u1_part_wd << 2;
|
||||
ps_pred->i1_mb_partheight = u1_part_ht << 2;
|
||||
ps_pred->u1_mc_addr_ofst = u1_ofst_in_word;
|
||||
ps_pred->u1_dydx = (u1_dy << 2) + u1_dx;
|
||||
ps_pred->u1_is_bi_direct = u1_is_bi_dir;
|
||||
ps_pred->u1_pi1_wt_ofst_rec_v = (UWORD8 *)pu4_wt_offset;
|
||||
|
|
@ -789,9 +773,7 @@ WORD32 ih264d_form_mb_part_info_mp(pred_info_pkd_t *ps_pred_pkd,
|
|||
(u2_pic_ht - (1 << u1_mb_fld)), i2_frm_y);
|
||||
|
||||
i4_ref_offset = i2_frm_y * u2_frm_wd + i2_frm_x * YUV420SP_FACTOR;
|
||||
u1_ofst_in_word = 0;
|
||||
u1_dma_wd = (i1_mc_wd + u1_ofst_in_word + 3) & 0xFC;
|
||||
i4_ref_offset -= u1_ofst_in_word;
|
||||
u1_dma_wd = (i1_mc_wd + 3) & 0xFC;
|
||||
|
||||
/********************************************************************/
|
||||
/* Calulating the horizontal and the vertical u4_ofst from top left */
|
||||
|
|
@ -828,7 +810,6 @@ WORD32 ih264d_form_mb_part_info_mp(pred_info_pkd_t *ps_pred_pkd,
|
|||
|
||||
ps_pred->i1_mb_partwidth = u1_part_wd << 1;
|
||||
ps_pred->i1_mb_partheight = u1_part_ht << 1;
|
||||
ps_pred->u1_mc_addr_ofst = u1_ofst_in_word;
|
||||
ps_pred->u1_dydx = (u1_dy << 3) + u1_dx;
|
||||
ps_pred->u1_is_bi_direct = u1_is_bi_dir;
|
||||
ps_pred->u1_wght_pred_type = u1_wght_pred_type;
|
||||
|
|
@ -976,7 +957,7 @@ void ih264d_motion_compensate_bp(dec_struct_t * ps_dec, dec_mb_info_t *ps_cur_mb
|
|||
UWORD8 *pu1_ref_u;
|
||||
|
||||
u2_ref_wd_uv = ps_pred->u2_frm_wd;
|
||||
pu1_ref_u = ps_pred->pu1_u_ref + ps_pred->u1_mc_addr_ofst;
|
||||
pu1_ref_u = ps_pred->pu1_u_ref;
|
||||
|
||||
u4_wd_uv = ps_pred->i1_mb_partwidth;
|
||||
u4_ht_uv = ps_pred->i1_mb_partheight;
|
||||
|
|
@ -1030,8 +1011,8 @@ void ih264d_motion_compensate_mp(dec_struct_t * ps_dec, dec_mb_info_t *ps_cur_mb
|
|||
WORD16 *pi16_intm;
|
||||
UWORD32 u2_num_pels, u2_ref_wd_y, u2_ref_wd_uv, u2_dst_wd;
|
||||
UWORD32 u2_dest_wd_y, u2_dest_wd_uv;
|
||||
UWORD32 u2_row_buf_wd_y = ps_dec->u2_mb_group_cols_y1;
|
||||
UWORD32 u2_row_buf_wd_uv = ps_dec->u2_mb_group_cols_cr1;
|
||||
UWORD32 u2_row_buf_wd_y = 0;
|
||||
UWORD32 u2_row_buf_wd_uv = 0;
|
||||
UWORD32 u2_log2Y_crwd = ps_dec->ps_cur_slice->u2_log2Y_crwd;
|
||||
UWORD32 u4_wd_y, u4_ht_y, u1_dir, u4_wd_uv;
|
||||
UWORD32 u4_ht_uv;
|
||||
|
|
@ -1052,9 +1033,11 @@ void ih264d_motion_compensate_mp(dec_struct_t * ps_dec, dec_mb_info_t *ps_cur_mb
|
|||
|
||||
PROFILE_DISABLE_INTER_PRED()
|
||||
ps_pred = ps_dec->ps_pred ;
|
||||
/* Initialize both ps_pred_y_forw an y_back to avoid static analysis warnigns */
|
||||
/* Initialize both ps_pred_y_forw, ps_pred_cr_forw and ps_pred_y_back
|
||||
* to avoid static analysis warnings */
|
||||
ps_pred_y_forw = ps_pred;
|
||||
ps_pred_y_back = ps_pred;
|
||||
ps_pred_cr_forw = ps_pred;
|
||||
|
||||
if(ps_dec->u1_separate_parse)
|
||||
u2_log2Y_crwd = ps_dec->ps_decode_cur_slice->u2_log2Y_crwd;
|
||||
|
|
@ -1068,7 +1051,7 @@ void ih264d_motion_compensate_mp(dec_struct_t * ps_dec, dec_mb_info_t *ps_cur_mb
|
|||
|
||||
pi16_intm = ps_dec->pi2_pred1;
|
||||
puc_pred0 = (UWORD8 *)pi16_intm;
|
||||
puc_pred1 = puc_pred0 + MB_SIZE * MB_SIZE;
|
||||
puc_pred1 = puc_pred0 + PRED_BUFFER_WIDTH * PRED_BUFFER_HEIGHT * sizeof(WORD16);
|
||||
|
||||
for(u2_num_pels = 0; u2_num_pels < 256;)
|
||||
{
|
||||
|
|
@ -1103,15 +1086,6 @@ void ih264d_motion_compensate_mp(dec_struct_t * ps_dec, dec_mb_info_t *ps_cur_mb
|
|||
u4_wd_y = ps_pred->i1_mb_partwidth;
|
||||
u4_ht_y = ps_pred->i1_mb_partheight;
|
||||
|
||||
if(ps_pred->i1_pod_ht)
|
||||
{
|
||||
pu1_pred = ps_pred->pu1_pred;
|
||||
pu1_dma_dst = ps_pred->pu1_dma_dest_addr;
|
||||
u1_dma_wd = ps_pred->u1_dma_wd_y;
|
||||
u1_dma_ht = ps_pred->u1_dma_ht_y;
|
||||
u2_frm_wd = ps_dec->u2_frm_wd_y << u1_mb_or_pic_fld;
|
||||
}
|
||||
|
||||
uc_dx = ps_pred->u1_dydx;
|
||||
uc_dy = uc_dx >> 2;
|
||||
uc_dx &= 0x3;
|
||||
|
|
@ -1136,12 +1110,14 @@ void ih264d_motion_compensate_mp(dec_struct_t * ps_dec, dec_mb_info_t *ps_cur_mb
|
|||
|
||||
if(ps_pred->i1_pod_ht)
|
||||
{
|
||||
pu1_pred = ps_pred->pu1_pred;
|
||||
pu1_dma_dst = ps_pred->pu1_dma_dest_addr;
|
||||
u1_dma_wd = ps_pred->u1_dma_wd_y;
|
||||
u1_dma_ht = ps_pred->u1_dma_ht_y;
|
||||
u2_frm_wd = ps_dec->u2_frm_wd_y << u1_mb_or_pic_fld;
|
||||
if(ps_pred->i1_pod_ht < 0)
|
||||
{
|
||||
pu1_dma_dst =
|
||||
pu1_dma_dst
|
||||
- (ps_pred->i1_pod_ht
|
||||
* ps_pred->u2_u1_ref_buf_wd);
|
||||
pu1_dma_dst = pu1_dma_dst - (ps_pred->i1_pod_ht * ps_pred->u2_u1_ref_buf_wd);
|
||||
}
|
||||
ih264d_copy_2d1d(pu1_pred, pu1_dma_dst, u2_frm_wd, u1_dma_wd,
|
||||
u1_dma_ht);
|
||||
|
|
@ -1246,9 +1222,7 @@ void ih264d_motion_compensate_mp(dec_struct_t * ps_dec, dec_mb_info_t *ps_cur_mb
|
|||
/* (Table 8-9 of standard) */
|
||||
/******************************************************************/
|
||||
if((ps_pred + 1)->i1_pod_ht)
|
||||
|
||||
{
|
||||
|
||||
pu1_pred = (ps_pred + 1)->pu1_pred_u;
|
||||
pu1_dma_dst = (ps_pred + 1)->pu1_dma_dest_addr;
|
||||
u1_dma_ht = (ps_pred + 1)->u1_dma_ht_uv;
|
||||
|
|
@ -1272,7 +1246,7 @@ void ih264d_motion_compensate_mp(dec_struct_t * ps_dec, dec_mb_info_t *ps_cur_mb
|
|||
}
|
||||
|
||||
ih264d_multiplex_ref_data(ps_dec, ps_pred, pu1_dest_y,
|
||||
pu1_dest_u, pu1_dest_v, ps_cur_mb_info,
|
||||
pu1_dest_u, ps_cur_mb_info,
|
||||
u2_dest_wd_y, u2_dest_wd_uv,
|
||||
u1_dir);
|
||||
ps_pred += 2;
|
||||
|
|
@ -1417,14 +1391,13 @@ void ih264d_multiplex_ref_data(dec_struct_t * ps_dec,
|
|||
pred_info_t *ps_pred,
|
||||
UWORD8* pu1_dest_y,
|
||||
UWORD8* pu1_dest_u,
|
||||
UWORD8* pu1_dest_v,
|
||||
dec_mb_info_t *ps_cur_mb_info,
|
||||
UWORD16 u2_dest_wd_y,
|
||||
UWORD16 u2_dest_wd_uv,
|
||||
UWORD8 u1_dir)
|
||||
{
|
||||
UWORD16 u2_mask = ps_cur_mb_info->u2_mask[u1_dir];
|
||||
UWORD8 *pu1_ref_y, *pu1_ref_u, *pu1_ref_v;
|
||||
UWORD8 *pu1_ref_y, *pu1_ref_u;
|
||||
UWORD8 uc_cond, i, j, u1_dydx;
|
||||
UWORD16 u2_ref_wd_y, u2_ref_wd_uv;
|
||||
|
||||
|
|
@ -1432,28 +1405,26 @@ void ih264d_multiplex_ref_data(dec_struct_t * ps_dec,
|
|||
|
||||
if(ps_pred->i1_pod_ht)
|
||||
{
|
||||
pu1_ref_y = ps_pred->pu1_dma_dest_addr + ps_pred->u1_mc_addr_ofst;
|
||||
pu1_ref_y = ps_pred->pu1_dma_dest_addr;
|
||||
|
||||
u2_ref_wd_y = ps_pred->u2_u1_ref_buf_wd;
|
||||
}
|
||||
else
|
||||
{
|
||||
pu1_ref_y = ps_pred->pu1_y_ref + ps_pred->u1_mc_addr_ofst;
|
||||
pu1_ref_y = ps_pred->pu1_y_ref;
|
||||
u2_ref_wd_y = ps_pred->u2_frm_wd;
|
||||
}
|
||||
|
||||
ps_pred++;
|
||||
if(ps_pred->i1_pod_ht)
|
||||
{
|
||||
pu1_ref_u = ps_pred->pu1_dma_dest_addr + ps_pred->u1_mc_addr_ofst;
|
||||
pu1_ref_v = pu1_ref_u + ps_pred->u2_u1_ref_buf_wd * ps_pred->i1_dma_ht;
|
||||
pu1_ref_u = ps_pred->pu1_dma_dest_addr;
|
||||
u2_ref_wd_uv = ps_pred->u2_u1_ref_buf_wd * YUV420SP_FACTOR;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
pu1_ref_u = ps_pred->pu1_u_ref + ps_pred->u1_mc_addr_ofst;
|
||||
pu1_ref_v = ps_pred->pu1_v_ref + ps_pred->u1_mc_addr_ofst;
|
||||
pu1_ref_u = ps_pred->pu1_u_ref;
|
||||
u2_ref_wd_uv = ps_pred->u2_frm_wd;
|
||||
|
||||
}
|
||||
|
|
@ -1462,18 +1433,14 @@ void ih264d_multiplex_ref_data(dec_struct_t * ps_dec,
|
|||
|
||||
{
|
||||
UWORD8 uc_dx, uc_dy;
|
||||
UWORD8 *pu1_scratch_v, *pu1_scratch_u;
|
||||
UWORD8 *pu1_scratch_u;
|
||||
|
||||
uc_dx = u1_dydx & 0x3;
|
||||
uc_dy = u1_dydx >> 3;
|
||||
if(u1_dydx != 0)
|
||||
{
|
||||
pred_info_t * ps_prv_pred = ps_pred - 2;
|
||||
pu1_scratch_u = ps_prv_pred->pu1_dma_dest_addr
|
||||
+ ps_prv_pred->u1_mc_addr_ofst;
|
||||
pu1_scratch_v = pu1_scratch_u
|
||||
+ ps_prv_pred->u2_u1_ref_buf_wd
|
||||
* ps_prv_pred->i1_dma_ht;
|
||||
pu1_scratch_u = ps_prv_pred->pu1_dma_dest_addr;
|
||||
ps_dec->pf_inter_pred_chroma(pu1_ref_u, pu1_scratch_u,
|
||||
u2_ref_wd_uv, 16, uc_dx, uc_dy, 8,
|
||||
8);
|
||||
|
|
@ -1482,7 +1449,6 @@ void ih264d_multiplex_ref_data(dec_struct_t * ps_dec,
|
|||
/* buffer to be used below in ih264d_copy_multiplex_data functions */
|
||||
/* CHANGED CODE */
|
||||
pu1_ref_u = pu1_scratch_u;
|
||||
pu1_ref_v = pu1_scratch_v;
|
||||
u2_ref_wd_uv = 8 * YUV420SP_FACTOR;
|
||||
}
|
||||
}
|
||||
|
|
@ -1491,7 +1457,6 @@ void ih264d_multiplex_ref_data(dec_struct_t * ps_dec,
|
|||
{
|
||||
for(j = 0; j < 4; j++)
|
||||
{
|
||||
|
||||
uc_cond = u2_mask & 1;
|
||||
u2_mask >>= 1;
|
||||
if(uc_cond)
|
||||
|
|
@ -1532,16 +1497,12 @@ void ih264d_multiplex_ref_data(dec_struct_t * ps_dec,
|
|||
pu1_ref_y += 4;
|
||||
pu1_dest_u += 2 * YUV420SP_FACTOR;
|
||||
pu1_ref_u += 2 * YUV420SP_FACTOR;
|
||||
pu1_dest_v += 2;
|
||||
pu1_ref_v += 2;
|
||||
}
|
||||
}
|
||||
pu1_ref_y += 4 * (u2_ref_wd_y - 4);
|
||||
pu1_ref_u += 2 * (u2_ref_wd_uv - 4 * YUV420SP_FACTOR);
|
||||
pu1_ref_v += 2 * (u2_ref_wd_uv - 4);
|
||||
pu1_dest_y += 4 * (u2_dest_wd_y - 4);
|
||||
pu1_dest_u += 2 * (u2_dest_wd_uv - 4 * YUV420SP_FACTOR);
|
||||
pu1_dest_v += 2 * (u2_dest_wd_uv - 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ void ih264d_multiplex_ref_data(dec_struct_t * ps_dec,
|
|||
pred_info_t *ps_pred,
|
||||
UWORD8* pu1_dest_y,
|
||||
UWORD8* pu1_dest_u,
|
||||
UWORD8* pu1_dest_v,
|
||||
dec_mb_info_t *ps_cur_mb_info,
|
||||
UWORD16 u2_dest_wd_y,
|
||||
UWORD16 u2_dest_wd_uv,
|
||||
|
|
|
|||
|
|
@ -82,8 +82,8 @@ UWORD32 ih264d_get_mb_info_cavlc_nonmbaff(dec_struct_t *ps_dec,
|
|||
dec_mb_info_t * ps_cur_mb_info,
|
||||
UWORD32 u4_mbskip_run)
|
||||
{
|
||||
UWORD16 u2_mb_x;
|
||||
UWORD16 u2_mb_y;
|
||||
WORD32 mb_x;
|
||||
WORD32 mb_y;
|
||||
UWORD8 u1_mb_ngbr_avail = 0;
|
||||
UWORD16 u2_frm_width_in_mb = ps_dec->u2_frm_wd_in_mbs;
|
||||
WORD16 i2_prev_slice_mbx = ps_dec->i2_prev_slice_mbx;
|
||||
|
|
@ -93,42 +93,40 @@ UWORD32 ih264d_get_mb_info_cavlc_nonmbaff(dec_struct_t *ps_dec,
|
|||
/*--------------------------------------------------------------------*/
|
||||
/* Calculate values of mb_x and mb_y */
|
||||
/*--------------------------------------------------------------------*/
|
||||
u2_mb_x = ps_dec->u2_mbx;
|
||||
u2_mb_y = ps_dec->u2_mby;
|
||||
mb_x = (WORD16)ps_dec->u2_mbx;
|
||||
mb_y = (WORD16)ps_dec->u2_mby;
|
||||
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
ps_dec->u2_cur_mb_addr = u2_cur_mb_address;
|
||||
}
|
||||
u2_mb_x++;
|
||||
ps_dec->u2_cur_mb_addr = u2_cur_mb_address;
|
||||
|
||||
if(u2_mb_x == u2_frm_width_in_mb)
|
||||
mb_x++;
|
||||
|
||||
if(mb_x == u2_frm_width_in_mb)
|
||||
{
|
||||
u2_mb_x = 0;
|
||||
u2_mb_y++;
|
||||
mb_x = 0;
|
||||
mb_y++;
|
||||
}
|
||||
if(u2_mb_y > ps_dec->i2_prev_slice_mby)
|
||||
if(mb_y > ps_dec->i2_prev_slice_mby)
|
||||
{
|
||||
/* if not in the immemdiate row of prev slice end then top
|
||||
will be available */
|
||||
if(u2_mb_y > (ps_dec->i2_prev_slice_mby + 1))
|
||||
if(mb_y > (ps_dec->i2_prev_slice_mby + 1))
|
||||
i2_prev_slice_mbx = -1;
|
||||
|
||||
if(u2_mb_x > i2_prev_slice_mbx)
|
||||
if(mb_x > i2_prev_slice_mbx)
|
||||
{
|
||||
u1_mb_ngbr_avail |= TOP_MB_AVAILABLE_MASK;
|
||||
u2_top_right_mask |= TOP_RIGHT_TOP_AVAILABLE;
|
||||
u2_top_left_mask |= TOP_LEFT_TOP_AVAILABLE;
|
||||
}
|
||||
|
||||
if((u2_mb_x > (i2_prev_slice_mbx - 1))
|
||||
&& (u2_mb_x != (u2_frm_width_in_mb - 1)))
|
||||
if((mb_x > (i2_prev_slice_mbx - 1))
|
||||
&& (mb_x != (u2_frm_width_in_mb - 1)))
|
||||
{
|
||||
u1_mb_ngbr_avail |= TOP_RIGHT_MB_AVAILABLE_MASK;
|
||||
u2_top_right_mask |= TOP_RIGHT_TOPR_AVAILABLE;
|
||||
}
|
||||
|
||||
if(u2_mb_x > (i2_prev_slice_mbx + 1))
|
||||
if(mb_x > (i2_prev_slice_mbx + 1))
|
||||
{
|
||||
u1_mb_ngbr_avail |= TOP_LEFT_MB_AVAILABLE_MASK;
|
||||
u2_top_left_mask |= TOP_LEFT_TOPL_AVAILABLE;
|
||||
|
|
@ -139,7 +137,7 @@ UWORD32 ih264d_get_mb_info_cavlc_nonmbaff(dec_struct_t *ps_dec,
|
|||
}
|
||||
|
||||
/* Same row */
|
||||
if(u2_mb_x > (i2_prev_slice_mbx + 1))
|
||||
if(mb_x > (i2_prev_slice_mbx + 1))
|
||||
{
|
||||
u1_mb_ngbr_avail |= LEFT_MB_AVAILABLE_MASK;
|
||||
u2_top_left_mask |= TOP_LEFT_LEFT_AVAILABLE;
|
||||
|
|
@ -152,19 +150,19 @@ UWORD32 ih264d_get_mb_info_cavlc_nonmbaff(dec_struct_t *ps_dec,
|
|||
/* copy the parameters of topleft Mb */
|
||||
ps_cur_mb_info->u1_topleft_mbtype = ps_dec->u1_topleft_mbtype;
|
||||
/* Neighbour pointer assignments*/
|
||||
ps_cur_mb_info->ps_curmb = ps_cur_mb_row + u2_mb_x;
|
||||
ps_cur_mb_info->ps_left_mb = ps_cur_mb_row + u2_mb_x - 1;
|
||||
ps_cur_mb_info->ps_top_mb = ps_top_mb_row + u2_mb_x;
|
||||
ps_cur_mb_info->ps_top_right_mb = ps_top_mb_row + u2_mb_x + 1;
|
||||
ps_cur_mb_info->ps_curmb = ps_cur_mb_row + mb_x;
|
||||
ps_cur_mb_info->ps_left_mb = ps_cur_mb_row + mb_x - 1;
|
||||
ps_cur_mb_info->ps_top_mb = ps_top_mb_row + mb_x;
|
||||
ps_cur_mb_info->ps_top_right_mb = ps_top_mb_row + mb_x + 1;
|
||||
|
||||
/* Update the parameters of topleftmb*/
|
||||
ps_dec->u1_topleft_mbtype = ps_cur_mb_info->ps_top_mb->u1_mb_type;
|
||||
}
|
||||
|
||||
ps_dec->u2_mby = u2_mb_y;
|
||||
ps_dec->u2_mbx = u2_mb_x;
|
||||
ps_cur_mb_info->u2_mbx = u2_mb_x;
|
||||
ps_cur_mb_info->u2_mby = u2_mb_y;
|
||||
ps_dec->u2_mby = mb_y;
|
||||
ps_dec->u2_mbx = mb_x;
|
||||
ps_cur_mb_info->u2_mbx = mb_x;
|
||||
ps_cur_mb_info->u2_mby = mb_y;
|
||||
ps_cur_mb_info->u1_topmb = 1;
|
||||
ps_dec->i4_submb_ofst += SUB_BLK_SIZE;
|
||||
ps_dec->u1_mb_ngbr_availablity = u1_mb_ngbr_avail;
|
||||
|
|
@ -231,10 +229,7 @@ UWORD32 ih264d_get_mb_info_cavlc_mbaff(dec_struct_t *ps_dec,
|
|||
u2_mb_x = ps_dec->u2_mbx;
|
||||
u2_mb_y = ps_dec->u2_mby;
|
||||
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
ps_dec->u2_cur_mb_addr = u2_cur_mb_address;
|
||||
}
|
||||
ps_dec->u2_cur_mb_addr = u2_cur_mb_address;
|
||||
|
||||
|
||||
if(u1_top_mb)
|
||||
|
|
@ -369,8 +364,8 @@ UWORD32 ih264d_get_mb_info_cabac_nonmbaff(dec_struct_t *ps_dec,
|
|||
dec_mb_info_t * ps_cur_mb_info,
|
||||
UWORD32 u4_mbskip)
|
||||
{
|
||||
WORD32 u2_mb_x;
|
||||
WORD32 u2_mb_y;
|
||||
WORD32 mb_x;
|
||||
WORD32 mb_y;
|
||||
UWORD32 u1_mb_ngbr_avail = 0;
|
||||
UWORD32 u2_frm_width_in_mb = ps_dec->u2_frm_wd_in_mbs;
|
||||
UWORD32 u1_top_mb = 1;
|
||||
|
|
@ -382,52 +377,49 @@ UWORD32 ih264d_get_mb_info_cabac_nonmbaff(dec_struct_t *ps_dec,
|
|||
/*--------------------------------------------------------------------*/
|
||||
/* Calculate values of mb_x and mb_y */
|
||||
/*--------------------------------------------------------------------*/
|
||||
u2_mb_x = (WORD16)ps_dec->u2_mbx;
|
||||
u2_mb_y = ps_dec->u2_mby;
|
||||
mb_x = (WORD16)ps_dec->u2_mbx;
|
||||
mb_y = (WORD16)ps_dec->u2_mby;
|
||||
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
ps_dec->u2_cur_mb_addr = u2_cur_mb_address;
|
||||
}
|
||||
ps_dec->u2_cur_mb_addr = u2_cur_mb_address;
|
||||
|
||||
u2_mb_x++;
|
||||
if((UWORD32)u2_mb_x == u2_frm_width_in_mb)
|
||||
mb_x++;
|
||||
if((UWORD32)mb_x == u2_frm_width_in_mb)
|
||||
{
|
||||
u2_mb_x = 0;
|
||||
u2_mb_y++;
|
||||
mb_x = 0;
|
||||
mb_y++;
|
||||
}
|
||||
/*********************************************************************/
|
||||
/* Cabac Context Initialisations */
|
||||
/*********************************************************************/
|
||||
ps_dec->ps_curr_ctxt_mb_info = p_ctx_inc_mb_map + u2_mb_x;
|
||||
ps_dec->ps_curr_ctxt_mb_info = p_ctx_inc_mb_map + mb_x;
|
||||
ps_dec->p_left_ctxt_mb_info = p_ctx_inc_mb_map - 1;
|
||||
ps_dec->p_top_ctxt_mb_info = p_ctx_inc_mb_map - 1;
|
||||
|
||||
/********************************************************************/
|
||||
/* neighbour availablility */
|
||||
/********************************************************************/
|
||||
if(u2_mb_y > ps_dec->i2_prev_slice_mby)
|
||||
if(mb_y > ps_dec->i2_prev_slice_mby)
|
||||
{
|
||||
/* if not in the immemdiate row of prev slice end then top
|
||||
will be available */
|
||||
if(u2_mb_y > (ps_dec->i2_prev_slice_mby + 1))
|
||||
if(mb_y > (ps_dec->i2_prev_slice_mby + 1))
|
||||
i2_prev_slice_mbx = -1;
|
||||
|
||||
if(u2_mb_x > i2_prev_slice_mbx)
|
||||
if(mb_x > i2_prev_slice_mbx)
|
||||
{
|
||||
u1_mb_ngbr_avail |= TOP_MB_AVAILABLE_MASK;
|
||||
u2_top_right_mask |= TOP_RIGHT_TOP_AVAILABLE;
|
||||
u2_top_left_mask |= TOP_LEFT_TOP_AVAILABLE;
|
||||
ps_dec->p_top_ctxt_mb_info = ps_dec->ps_curr_ctxt_mb_info;
|
||||
}
|
||||
if((u2_mb_x > (i2_prev_slice_mbx - 1))
|
||||
&& ((UWORD32)u2_mb_x != (u2_frm_width_in_mb - 1)))
|
||||
if((mb_x > (i2_prev_slice_mbx - 1))
|
||||
&& ((UWORD32)mb_x != (u2_frm_width_in_mb - 1)))
|
||||
{
|
||||
u1_mb_ngbr_avail |= TOP_RIGHT_MB_AVAILABLE_MASK;
|
||||
u2_top_right_mask |= TOP_RIGHT_TOPR_AVAILABLE;
|
||||
}
|
||||
|
||||
if(u2_mb_x > (i2_prev_slice_mbx + 1))
|
||||
if(mb_x > (i2_prev_slice_mbx + 1))
|
||||
{
|
||||
u1_mb_ngbr_avail |= TOP_LEFT_MB_AVAILABLE_MASK;
|
||||
u2_top_left_mask |= TOP_LEFT_TOPL_AVAILABLE;
|
||||
|
|
@ -436,7 +428,7 @@ UWORD32 ih264d_get_mb_info_cabac_nonmbaff(dec_struct_t *ps_dec,
|
|||
i2_prev_slice_mbx = -1;
|
||||
}
|
||||
/* Same row */
|
||||
if(u2_mb_x > (i2_prev_slice_mbx + 1))
|
||||
if(mb_x > (i2_prev_slice_mbx + 1))
|
||||
{
|
||||
u1_mb_ngbr_avail |= LEFT_MB_AVAILABLE_MASK;
|
||||
u2_top_left_mask |= TOP_LEFT_LEFT_AVAILABLE;
|
||||
|
|
@ -448,19 +440,19 @@ UWORD32 ih264d_get_mb_info_cabac_nonmbaff(dec_struct_t *ps_dec,
|
|||
/* copy the parameters of topleft Mb */
|
||||
ps_cur_mb_info->u1_topleft_mbtype = ps_dec->u1_topleft_mbtype;
|
||||
/* Neighbour pointer assignments*/
|
||||
ps_cur_mb_info->ps_curmb = ps_cur_mb_row + u2_mb_x;
|
||||
ps_cur_mb_info->ps_left_mb = ps_cur_mb_row + u2_mb_x - 1;
|
||||
ps_cur_mb_info->ps_top_mb = ps_top_mb_row + u2_mb_x;
|
||||
ps_cur_mb_info->ps_top_right_mb = ps_top_mb_row + u2_mb_x + 1;
|
||||
ps_cur_mb_info->ps_curmb = ps_cur_mb_row + mb_x;
|
||||
ps_cur_mb_info->ps_left_mb = ps_cur_mb_row + mb_x - 1;
|
||||
ps_cur_mb_info->ps_top_mb = ps_top_mb_row + mb_x;
|
||||
ps_cur_mb_info->ps_top_right_mb = ps_top_mb_row + mb_x + 1;
|
||||
|
||||
/* Update the parameters of topleftmb*/
|
||||
ps_dec->u1_topleft_mbtype = ps_cur_mb_info->ps_top_mb->u1_mb_type;
|
||||
}
|
||||
|
||||
ps_dec->u2_mby = u2_mb_y;
|
||||
ps_dec->u2_mbx = u2_mb_x;
|
||||
ps_cur_mb_info->u2_mbx = u2_mb_x;
|
||||
ps_cur_mb_info->u2_mby = u2_mb_y;
|
||||
ps_dec->u2_mby = mb_y;
|
||||
ps_dec->u2_mbx = mb_x;
|
||||
ps_cur_mb_info->u2_mbx = mb_x;
|
||||
ps_cur_mb_info->u2_mby = mb_y;
|
||||
ps_cur_mb_info->u1_topmb = u1_top_mb;
|
||||
ps_dec->i4_submb_ofst += SUB_BLK_SIZE;
|
||||
ps_dec->u1_mb_ngbr_availablity = u1_mb_ngbr_avail;
|
||||
|
|
@ -554,8 +546,8 @@ UWORD32 ih264d_get_mb_info_cabac_mbaff(dec_struct_t *ps_dec,
|
|||
dec_mb_info_t * ps_cur_mb_info,
|
||||
UWORD32 u4_mbskip)
|
||||
{
|
||||
UWORD16 u2_mb_x;
|
||||
UWORD16 u2_mb_y;
|
||||
WORD32 mb_x;
|
||||
WORD32 mb_y;
|
||||
UWORD8 u1_mb_ngbr_avail = 0;
|
||||
UWORD16 u2_frm_width_in_mb = ps_dec->u2_frm_wd_in_mbs;
|
||||
ctxt_inc_mb_info_t * const p_ctx_inc_mb_map = ps_dec->p_ctxt_inc_mb_map;
|
||||
|
|
@ -573,13 +565,10 @@ UWORD32 ih264d_get_mb_info_cabac_mbaff(dec_struct_t *ps_dec,
|
|||
/*--------------------------------------------------------------------*/
|
||||
/* Calculate values of mb_x and mb_y */
|
||||
/*--------------------------------------------------------------------*/
|
||||
u2_mb_x = ps_dec->u2_mbx;
|
||||
u2_mb_y = ps_dec->u2_mby;
|
||||
mb_x = (WORD16)ps_dec->u2_mbx;
|
||||
mb_y = (WORD16)ps_dec->u2_mby;
|
||||
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
ps_dec->u2_cur_mb_addr = u2_cur_mb_address;
|
||||
}
|
||||
ps_dec->u2_cur_mb_addr = u2_cur_mb_address;
|
||||
|
||||
ps_top_ctxt = ps_left_ctxt = p_ctx_inc_mb_map - 1;
|
||||
|
||||
|
|
@ -588,20 +577,20 @@ UWORD32 ih264d_get_mb_info_cabac_mbaff(dec_struct_t *ps_dec,
|
|||
ctxt_inc_mb_info_t *ps_left_mb_of_bot = ps_left_ctxt;
|
||||
ctxt_inc_mb_info_t *ps_top_mb_of_bot = ps_top_ctxt;
|
||||
|
||||
u2_mb_x++;
|
||||
mb_x++;
|
||||
|
||||
if(u2_mb_x == u2_frm_width_in_mb)
|
||||
if(mb_x == u2_frm_width_in_mb)
|
||||
{
|
||||
u2_mb_x = 0;
|
||||
u2_mb_y += 2;
|
||||
mb_x = 0;
|
||||
mb_y += 2;
|
||||
}
|
||||
|
||||
ps_curr_ctxt = p_ctx_inc_mb_map + (u2_mb_x << 1);
|
||||
if(u2_mb_y > ps_dec->i2_prev_slice_mby)
|
||||
ps_curr_ctxt = p_ctx_inc_mb_map + (mb_x << 1);
|
||||
if(mb_y > ps_dec->i2_prev_slice_mby)
|
||||
{
|
||||
UWORD8 u1_cur_mb_fld_flag_known = 0;
|
||||
/* Next row */
|
||||
if(u2_mb_x > 0)
|
||||
if(mb_x > 0)
|
||||
{
|
||||
/***********************************************************************/
|
||||
/* Left Mb is avialable */
|
||||
|
|
@ -609,16 +598,16 @@ UWORD32 ih264d_get_mb_info_cabac_mbaff(dec_struct_t *ps_dec,
|
|||
u1_mb_ngbr_avail |= LEFT_MB_AVAILABLE_MASK;
|
||||
ps_left_ctxt = ps_curr_ctxt - 2;
|
||||
ps_left_mb_of_bot = ps_curr_ctxt - 1;
|
||||
u1_cur_mb_field = u4_left_mb_pair_fld = ps_cur_mb_row[(u2_mb_x
|
||||
u1_cur_mb_field = u4_left_mb_pair_fld = ps_cur_mb_row[(mb_x
|
||||
<< 1) - 1].u1_mb_fld;
|
||||
u1_cur_mb_fld_flag_known = 1;
|
||||
u2_top_left_mask |= TOP_LEFT_LEFT_AVAILABLE;
|
||||
}
|
||||
/* if not in the immemdiate row of prev slice end then top
|
||||
will be available */
|
||||
if(u2_mb_y > (ps_dec->i2_prev_slice_mby + 2))
|
||||
if(mb_y > (ps_dec->i2_prev_slice_mby + 2))
|
||||
i2_prev_slice_mbx = -1;
|
||||
if(u2_mb_x > i2_prev_slice_mbx)
|
||||
if(mb_x > i2_prev_slice_mbx)
|
||||
{
|
||||
/*********************************************************************/
|
||||
/* Top Mb is avialable */
|
||||
|
|
@ -629,7 +618,7 @@ UWORD32 ih264d_get_mb_info_cabac_mbaff(dec_struct_t *ps_dec,
|
|||
|
||||
/* point to MbAddrB + 1 */
|
||||
ps_top_ctxt = ps_curr_ctxt + 1;
|
||||
u4_top_mb_pair_fld = ps_top_mb_row[(u2_mb_x << 1)].u1_mb_fld;
|
||||
u4_top_mb_pair_fld = ps_top_mb_row[(mb_x << 1)].u1_mb_fld;
|
||||
|
||||
u1_cur_mb_field =
|
||||
u1_cur_mb_fld_flag_known ?
|
||||
|
|
@ -641,14 +630,14 @@ UWORD32 ih264d_get_mb_info_cabac_mbaff(dec_struct_t *ps_dec,
|
|||
ps_top_ctxt -= (u1_cur_mb_field && u4_top_mb_pair_fld);
|
||||
}
|
||||
|
||||
if((u2_mb_x > (i2_prev_slice_mbx - 1))
|
||||
&& (u2_mb_x != (u2_frm_width_in_mb - 1)))
|
||||
if((mb_x > (i2_prev_slice_mbx - 1))
|
||||
&& (mb_x != (u2_frm_width_in_mb - 1)))
|
||||
{
|
||||
u1_mb_ngbr_avail |= TOP_RIGHT_MB_AVAILABLE_MASK;
|
||||
u2_top_right_mask |= TOP_RIGHT_TOPR_AVAILABLE;
|
||||
}
|
||||
|
||||
if(u2_mb_x > (i2_prev_slice_mbx + 1))
|
||||
if(mb_x > (i2_prev_slice_mbx + 1))
|
||||
{
|
||||
u1_mb_ngbr_avail |= TOP_LEFT_MB_AVAILABLE_MASK;
|
||||
u2_top_left_mask |= TOP_LEFT_TOPL_AVAILABLE;
|
||||
|
|
@ -657,14 +646,14 @@ UWORD32 ih264d_get_mb_info_cabac_mbaff(dec_struct_t *ps_dec,
|
|||
else
|
||||
{
|
||||
/* Same row */
|
||||
if(u2_mb_x > (i2_prev_slice_mbx + 1))
|
||||
if(mb_x > (i2_prev_slice_mbx + 1))
|
||||
{
|
||||
/***************************************************************/
|
||||
/* Left Mb is avialable */
|
||||
/***************************************************************/
|
||||
u1_mb_ngbr_avail |= LEFT_MB_AVAILABLE_MASK;
|
||||
|
||||
u1_cur_mb_field = u4_left_mb_pair_fld = ps_cur_mb_row[(u2_mb_x
|
||||
u1_cur_mb_field = u4_left_mb_pair_fld = ps_cur_mb_row[(mb_x
|
||||
<< 1) - 1].u1_mb_fld;
|
||||
ps_left_ctxt = ps_curr_ctxt - 2;
|
||||
ps_left_mb_of_bot = ps_curr_ctxt - 1;
|
||||
|
|
@ -730,8 +719,8 @@ UWORD32 ih264d_get_mb_info_cabac_mbaff(dec_struct_t *ps_dec,
|
|||
ps_dec->u1_cur_mb_fld_dec_flag = u1_cur_mb_field;
|
||||
ps_dec->u2_top_left_mask = u2_top_left_mask;
|
||||
ps_dec->u2_top_right_mask = u2_top_right_mask;
|
||||
ps_dec->u2_mby = u2_mb_y;
|
||||
ps_dec->u2_mbx = u2_mb_x;
|
||||
ps_dec->u2_mby = mb_y;
|
||||
ps_dec->u2_mbx = mb_x;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -739,11 +728,11 @@ UWORD32 ih264d_get_mb_info_cabac_mbaff(dec_struct_t *ps_dec,
|
|||
u1_mb_ngbr_avail = ps_dec->u1_mb_ngbr_availablity;
|
||||
u2_top_left_mask = ps_dec->u2_top_left_mask;
|
||||
u2_top_right_mask = ps_dec->u2_top_right_mask;
|
||||
ps_curr_ctxt = p_ctx_inc_mb_map + (u2_mb_x << 1) + 1;
|
||||
ps_curr_ctxt = p_ctx_inc_mb_map + (mb_x << 1) + 1;
|
||||
|
||||
if(u1_mb_ngbr_avail & LEFT_MB_AVAILABLE_MASK)
|
||||
{
|
||||
u4_left_mb_pair_fld = ps_cur_mb_row[(u2_mb_x << 1) - 1].u1_mb_fld;
|
||||
u4_left_mb_pair_fld = ps_cur_mb_row[(mb_x << 1) - 1].u1_mb_fld;
|
||||
|
||||
/* point to A if top else A+1 */
|
||||
ps_left_ctxt = ps_curr_ctxt - 2
|
||||
|
|
@ -805,8 +794,8 @@ UWORD32 ih264d_get_mb_info_cabac_mbaff(dec_struct_t *ps_dec,
|
|||
}
|
||||
}
|
||||
|
||||
ps_cur_mb_info->u2_mbx = u2_mb_x;
|
||||
ps_cur_mb_info->u2_mby = u2_mb_y;
|
||||
ps_cur_mb_info->u2_mbx = mb_x;
|
||||
ps_cur_mb_info->u2_mby = mb_y;
|
||||
ps_cur_mb_info->u1_topmb = u1_top_mb;
|
||||
ps_dec->i4_submb_ofst += SUB_BLK_SIZE;
|
||||
ps_dec->u1_mb_ngbr_availablity = u1_mb_ngbr_avail;
|
||||
|
|
@ -1399,7 +1388,7 @@ void ih264d_get_mbaff_neighbours(dec_struct_t * ps_dec,
|
|||
**************************************************************************
|
||||
*/
|
||||
void ih264d_transfer_mb_group_data(dec_struct_t * ps_dec,
|
||||
const WORD8 c_numMbs,
|
||||
const UWORD8 u1_num_mbs,
|
||||
const UWORD8 u1_end_of_row, /* Cur n-Mb End of Row Flag */
|
||||
const UWORD8 u1_end_of_row_next /* Next n-Mb End of Row Flag */
|
||||
)
|
||||
|
|
@ -1453,12 +1442,12 @@ void ih264d_transfer_mb_group_data(dec_struct_t * ps_dec,
|
|||
/*
|
||||
* The Slice boundary is also a valid condition to transfer. So recalculate
|
||||
* the Left increment, in case the number of MBs is lesser than the
|
||||
* N MB value. c_numMbs will be equal to N of N MB if the entire N Mb is
|
||||
* N MB value. u1_num_mbs will be equal to N of N MB if the entire N Mb is
|
||||
* decoded.
|
||||
*/
|
||||
ps_dec->s_tran_addrecon.u2_mv_left_inc = ((c_numMbs >> u1_mbaff) - 1)
|
||||
ps_dec->s_tran_addrecon.u2_mv_left_inc = ((u1_num_mbs >> u1_mbaff) - 1)
|
||||
<< (4 + u1_mbaff);
|
||||
ps_dec->s_tran_addrecon.u2_mv_top_left_inc = (c_numMbs << 2) - 1
|
||||
ps_dec->s_tran_addrecon.u2_mv_top_left_inc = (u1_num_mbs << 2) - 1
|
||||
- (u1_mbaff << 2);
|
||||
|
||||
if(ps_dec->u1_separate_parse == 0)
|
||||
|
|
@ -1467,29 +1456,18 @@ void ih264d_transfer_mb_group_data(dec_struct_t * ps_dec,
|
|||
ps_dec->ps_mv_left = ps_dec->ps_mv_cur
|
||||
+ ps_dec->s_tran_addrecon.u2_mv_left_inc;
|
||||
|
||||
ps_dec->ps_mv_cur += (c_numMbs << 4);
|
||||
ps_dec->ps_mv_cur += (u1_num_mbs << 4);
|
||||
}
|
||||
|
||||
/* Increment deblock parameters pointer in external memory */
|
||||
|
||||
if(ps_dec->u1_separate_parse == 1)
|
||||
{
|
||||
ps_dec->ps_deblk_mbn_dec_thrd += c_numMbs;
|
||||
ps_dec->ps_deblk_mbn_dec_thrd += u1_num_mbs;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ps_dec->u4_mb_level_deblk == 0)
|
||||
ps_dec->ps_deblk_mbn += c_numMbs;
|
||||
else
|
||||
{
|
||||
deblk_mb_t *temp;
|
||||
|
||||
/*swap previous and curr pointers*/
|
||||
ps_dec->ps_deblk_mbn = ps_dec->ps_deblk_mbn_prev;
|
||||
temp = ps_dec->ps_deblk_mbn_curr;
|
||||
ps_dec->ps_deblk_mbn_curr = ps_dec->ps_deblk_mbn_prev;
|
||||
ps_dec->ps_deblk_mbn_prev = temp;
|
||||
}
|
||||
ps_dec->ps_deblk_mbn += u1_num_mbs;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ void ih264d_get_mbaff_neighbours(dec_struct_t * ps_dec,
|
|||
void ih264d_update_mbaff_left_nnz(dec_struct_t * ps_dec,
|
||||
dec_mb_info_t * ps_cur_mb_info);
|
||||
void ih264d_transfer_mb_group_data(dec_struct_t * ps_dec,
|
||||
const WORD8 c_numMbs,
|
||||
const UWORD8 u1_num_mbs,
|
||||
const UWORD8 u1_end_of_row, /* Cur n-Mb End of Row Flag */
|
||||
const UWORD8 u1_end_of_row_next /* Next n-Mb End of Row Flag */
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1011,7 +1011,6 @@ WORD32 ih264d_mv_pred_ref_tfr_nby2_bmb(dec_struct_t * ps_dec,
|
|||
/* Loop on Partitions */
|
||||
/* direct mode is reflected as a single partition */
|
||||
/**************************************************/
|
||||
ps_dec->u4_dma_buf_idx = 0;
|
||||
for(j = 0; j < u1_num_part; j++, ps_part++)
|
||||
{
|
||||
u1_sub_mb_num = ps_part->u1_sub_mb_num;
|
||||
|
|
@ -1654,11 +1653,7 @@ WORD32 ih264d_parse_bslice(dec_struct_t * ps_dec, UWORD16 u2_first_mb_in_slice)
|
|||
ps_slice->i1_slice_beta_offset = 0;
|
||||
}
|
||||
|
||||
|
||||
/*set slice header cone to 2 ,to indicate correct header*/
|
||||
DATA_SYNC();
|
||||
|
||||
ps_dec->ps_parse_cur_slice->slice_header_done = 2;
|
||||
ps_dec->u1_slice_header_done = 2;
|
||||
|
||||
if(ps_pps->u1_entropy_coding_mode)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
#include "ih264d_quant_scaling.h"
|
||||
#include "ih264d_defs.h"
|
||||
#include "ivd.h"
|
||||
#include "ih264d.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
|
|
@ -332,12 +333,7 @@ WORD32 ih264d_parse_pps(dec_struct_t * ps_dec, dec_bit_stream_t * ps_bitstrm)
|
|||
if(ps_pps->i4_pic_scaling_matrix_present_flag)
|
||||
{
|
||||
/* read the scaling matrices */
|
||||
for(i4_i = 0;
|
||||
i4_i
|
||||
< (6
|
||||
+ (ps_pps->i4_transform_8x8_mode_flag
|
||||
<< 1));
|
||||
i4_i++)
|
||||
for(i4_i = 0; i4_i < (6 + (ps_pps->i4_transform_8x8_mode_flag << 1)); i4_i++)
|
||||
{
|
||||
ps_pps->u1_pic_scaling_list_present_flag[i4_i] =
|
||||
ih264d_get_bit_h264(ps_bitstrm);
|
||||
|
|
@ -548,22 +544,12 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
|
|||
|
||||
u1_level_idc = ih264d_get_bits_h264(ps_bitstrm, 8);
|
||||
|
||||
/*
|
||||
|
||||
if(ps_dec->u4_level_at_init < u1_level_idc)
|
||||
{
|
||||
UWORD32 i4_error_code;
|
||||
H264_DEC_DEBUG_PRINT("\nstream has the level more than the one which is set during init\n");
|
||||
i4_error_code = ERROR_ACTUAL_LEVEL_GREATER_THAN_INIT ;
|
||||
return i4_error_code;
|
||||
* Here instead of flagging the error, we could have ignored this error
|
||||
* and went ahead for further decoding, but we are not doing
|
||||
* so because, at least one header should be healthy to do the
|
||||
* decoding, and moreover, it may help to avoid the crashes in the erroneous
|
||||
* streams.
|
||||
*
|
||||
|
||||
return IH264D_UNSUPPORTED_LEVEL;
|
||||
}
|
||||
*/
|
||||
|
||||
COPYTHECONTEXT("SPS: u4_level_idc",u1_level_idc);
|
||||
|
||||
u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
|
||||
|
|
@ -962,7 +948,6 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
|
|||
ps_dec->u2_pic_ht = u2_pic_ht;
|
||||
|
||||
/* Determining the Width and Height of Frame from that of Picture */
|
||||
|
||||
ps_dec->u2_frm_wd_y = u2_frm_wd_y;
|
||||
ps_dec->u2_frm_ht_y = u2_frm_ht_y;
|
||||
|
||||
|
|
|
|||
|
|
@ -133,9 +133,9 @@ WORD32 ih264d_parse_imb_cavlc(dec_struct_t * ps_dec,
|
|||
if (!ps_cur_mb_info->u1_tran_form8x8)
|
||||
{
|
||||
ih264d_read_intra_pred_modes(ps_dec,
|
||||
((UWORD8 *)ps_dec->pv_parse_tu_coeff_data),
|
||||
((UWORD8 *)ps_dec->pv_parse_tu_coeff_data+16),
|
||||
ps_cur_mb_info->u1_tran_form8x8);
|
||||
((UWORD8 *)ps_dec->pv_parse_tu_coeff_data),
|
||||
((UWORD8 *)ps_dec->pv_parse_tu_coeff_data+16),
|
||||
ps_cur_mb_info->u1_tran_form8x8);
|
||||
UWORD8 *pu1_temp = (UWORD8 *)ps_dec->pv_parse_tu_coeff_data;
|
||||
pu1_temp += 32;
|
||||
ps_dec->pv_parse_tu_coeff_data = (void *)pu1_temp;
|
||||
|
|
@ -143,9 +143,9 @@ WORD32 ih264d_parse_imb_cavlc(dec_struct_t * ps_dec,
|
|||
else
|
||||
{
|
||||
ih264d_read_intra_pred_modes(ps_dec,
|
||||
((UWORD8 *)ps_dec->pv_parse_tu_coeff_data),
|
||||
((UWORD8 *)ps_dec->pv_parse_tu_coeff_data+4),
|
||||
ps_cur_mb_info->u1_tran_form8x8);
|
||||
((UWORD8 *)ps_dec->pv_parse_tu_coeff_data),
|
||||
((UWORD8 *)ps_dec->pv_parse_tu_coeff_data+4),
|
||||
ps_cur_mb_info->u1_tran_form8x8);
|
||||
UWORD8 *pu1_temp = (UWORD8 *)ps_dec->pv_parse_tu_coeff_data;
|
||||
pu1_temp += 8;
|
||||
ps_dec->pv_parse_tu_coeff_data = (void *)pu1_temp;
|
||||
|
|
@ -763,12 +763,10 @@ WORD32 ih264d_parse_islice_data_cavlc(dec_struct_t * ps_dec,
|
|||
WORD16 i2_cur_mb_addr;
|
||||
UWORD8 u1_mbaff;
|
||||
UWORD8 u1_num_mbs_next, u1_end_of_row, u1_tfr_n_mb;
|
||||
WORD32 ret;
|
||||
WORD32 ret = OK;
|
||||
|
||||
ps_dec->u1_qp = ps_slice->u1_slice_qp;
|
||||
ret = ih264d_update_qp(ps_dec, 0);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
ih264d_update_qp(ps_dec, 0);
|
||||
u1_mbaff = ps_slice->u1_mbaff_frame_flag;
|
||||
|
||||
/* initializations */
|
||||
|
|
@ -782,12 +780,16 @@ WORD32 ih264d_parse_islice_data_cavlc(dec_struct_t * ps_dec,
|
|||
{
|
||||
UWORD8 u1_mb_type;
|
||||
|
||||
ps_dec->pv_prev_mb_parse_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
|
||||
|
||||
if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u2_max_mb_addr)
|
||||
{
|
||||
ret = ERROR_MB_ADDRESS_T;
|
||||
break;
|
||||
}
|
||||
|
||||
ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs;
|
||||
ps_dec->u4_num_mbs_cur_nmb = u1_num_mbs;
|
||||
ps_dec->u4_num_pmbair = (u1_num_mbs >> u1_mbaff);
|
||||
|
||||
ps_cur_mb_info->u1_end_of_slice = 0;
|
||||
|
|
@ -919,11 +921,9 @@ WORD32 ih264d_parse_islice_data_cavlc(dec_struct_t * ps_dec,
|
|||
}
|
||||
else
|
||||
{
|
||||
ret = ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs,
|
||||
u1_num_mbs_next, u1_tfr_n_mb,
|
||||
u1_end_of_row);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs,
|
||||
u1_num_mbs_next, u1_tfr_n_mb,
|
||||
u1_end_of_row);
|
||||
}
|
||||
|
||||
if(u1_tfr_n_mb)
|
||||
|
|
@ -935,13 +935,12 @@ WORD32 ih264d_parse_islice_data_cavlc(dec_struct_t * ps_dec,
|
|||
}
|
||||
while(uc_more_data_flag);
|
||||
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
ps_dec->ps_parse_cur_slice->end_of_slice = 1;
|
||||
ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr
|
||||
ps_dec->u4_num_mbs_cur_nmb = 0;
|
||||
ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr
|
||||
|
||||
- (u2_first_mb_in_slice << u1_mbaff);
|
||||
}
|
||||
return OK;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -982,12 +981,10 @@ WORD32 ih264d_parse_islice_data_cabac(dec_struct_t * ps_dec,
|
|||
WORD16 i2_cur_mb_addr;
|
||||
UWORD8 u1_mbaff;
|
||||
UWORD8 u1_num_mbs_next, u1_end_of_row, u1_tfr_n_mb;
|
||||
WORD32 ret;
|
||||
WORD32 ret = OK;
|
||||
|
||||
ps_dec->u1_qp = ps_slice->u1_slice_qp;
|
||||
ret = ih264d_update_qp(ps_dec, 0);
|
||||
if(ret != 0)
|
||||
return ret;
|
||||
ih264d_update_qp(ps_dec, 0);
|
||||
u1_mbaff = ps_slice->u1_mbaff_frame_flag;
|
||||
|
||||
if(ps_bitstrm->u4_ofst & 0x07)
|
||||
|
|
@ -1011,10 +1008,20 @@ WORD32 ih264d_parse_islice_data_cabac(dec_struct_t * ps_dec,
|
|||
do
|
||||
{
|
||||
UWORD16 u2_mbx;
|
||||
|
||||
ps_dec->pv_prev_mb_parse_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
|
||||
|
||||
if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u2_max_mb_addr)
|
||||
{
|
||||
ret = ERROR_MB_ADDRESS_T;
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
UWORD8 u1_mb_type;
|
||||
|
||||
ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs;
|
||||
ps_dec->u4_num_mbs_cur_nmb = u1_num_mbs;
|
||||
ps_dec->u4_num_pmbair = (u1_num_mbs >> u1_mbaff);
|
||||
|
||||
ps_cur_mb_info->u1_end_of_slice = 0;
|
||||
|
|
@ -1076,8 +1083,6 @@ WORD32 ih264d_parse_islice_data_cabac(dec_struct_t * ps_dec,
|
|||
ih264d_update_mbaff_left_nnz(ps_dec, ps_cur_mb_info);
|
||||
}
|
||||
/* Next macroblock information */
|
||||
if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u2_max_mb_addr)
|
||||
return ERROR_MB_ADDRESS_T;
|
||||
i2_cur_mb_addr++;
|
||||
|
||||
if(ps_cur_mb_info->u1_topmb && u1_mbaff)
|
||||
|
|
@ -1135,11 +1140,9 @@ WORD32 ih264d_parse_islice_data_cabac(dec_struct_t * ps_dec,
|
|||
}
|
||||
else
|
||||
{
|
||||
ret = ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs,
|
||||
u1_num_mbs_next, u1_tfr_n_mb,
|
||||
u1_end_of_row);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs,
|
||||
u1_num_mbs_next, u1_tfr_n_mb,
|
||||
u1_end_of_row);
|
||||
}
|
||||
|
||||
if(u1_tfr_n_mb)
|
||||
|
|
@ -1151,13 +1154,12 @@ WORD32 ih264d_parse_islice_data_cabac(dec_struct_t * ps_dec,
|
|||
}
|
||||
while(uc_more_data_flag);
|
||||
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
ps_dec->ps_parse_cur_slice->end_of_slice = 1;
|
||||
ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr
|
||||
ps_dec->u4_num_mbs_cur_nmb = 0;
|
||||
ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr
|
||||
|
||||
- (u2_first_mb_in_slice << u1_mbaff);
|
||||
}
|
||||
return OK;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -1439,8 +1441,7 @@ WORD32 ih264d_parse_islice(dec_struct_t *ps_dec,
|
|||
|
||||
|
||||
/*set slice header cone to 2 ,to indicate correct header*/
|
||||
DATA_SYNC();
|
||||
ps_dec->ps_parse_cur_slice->slice_header_done = 2;
|
||||
ps_dec->u1_slice_header_done = 2;
|
||||
|
||||
if(ps_pps->u1_entropy_coding_mode)
|
||||
{
|
||||
|
|
@ -1457,9 +1458,6 @@ WORD32 ih264d_parse_islice(dec_struct_t *ps_dec,
|
|||
if(ret != OK)
|
||||
return ret;
|
||||
SWITCHONTRACE; SWITCHOFFTRACECABAC;
|
||||
if(ps_dec->ps_parse_cur_slice->u2_error_flag == 1)
|
||||
return 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@
|
|||
#include "ih264d_format_conv.h"
|
||||
#include "ih264d_quant_scaling.h"
|
||||
#include "ih264d_thread_parse_decode.h"
|
||||
#include "ih264d_thread_compute_bs.h"
|
||||
#include "ih264d_process_bslice.h"
|
||||
#include "ithread.h"
|
||||
#include "ih264d_utils.h"
|
||||
|
|
@ -820,7 +821,7 @@ WORD32 ih264d_parse_inter_slice_data_cabac(dec_struct_t * ps_dec,
|
|||
UWORD32 u1_deblk_mb_type;
|
||||
UWORD32 u1_mb_threshold;
|
||||
dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
|
||||
WORD32 ret;
|
||||
WORD32 ret = OK;
|
||||
|
||||
/******************************************************/
|
||||
/* Initialisations specific to B or P slice */
|
||||
|
|
@ -845,9 +846,7 @@ WORD32 ih264d_parse_inter_slice_data_cabac(dec_struct_t * ps_dec,
|
|||
/******************************************************/
|
||||
i2_cur_mb_addr = u2_first_mb_in_slice;
|
||||
ps_dec->u1_qp = ps_slice->u1_slice_qp;
|
||||
ret = ih264d_update_qp(ps_dec, 0);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
ih264d_update_qp(ps_dec, 0);
|
||||
u1_mb_idx = ps_dec->u1_mb_idx;
|
||||
u1_num_mbs = u1_mb_idx;
|
||||
u1_num_mbsNby2 = 0;
|
||||
|
|
@ -873,8 +872,16 @@ WORD32 ih264d_parse_inter_slice_data_cabac(dec_struct_t * ps_dec,
|
|||
UWORD8 u1_mb_type;
|
||||
UWORD32 u4_mb_skip;
|
||||
|
||||
ps_dec->pv_prev_mb_parse_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
|
||||
|
||||
if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u2_max_mb_addr)
|
||||
{
|
||||
ret = ERROR_MB_ADDRESS_T;
|
||||
break;
|
||||
}
|
||||
|
||||
ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs;
|
||||
ps_dec->u4_num_mbs_cur_nmb = u1_num_mbs;
|
||||
|
||||
ps_cur_mb_info->u1_Mux = 0;
|
||||
ps_dec->u4_num_pmbair = (u1_num_mbs >> u1_mbaff);
|
||||
|
|
@ -1001,8 +1008,6 @@ WORD32 ih264d_parse_inter_slice_data_cabac(dec_struct_t * ps_dec,
|
|||
ih264d_update_mbaff_left_nnz(ps_dec, ps_cur_mb_info);
|
||||
}
|
||||
/* Next macroblock information */
|
||||
if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u2_max_mb_addr)
|
||||
return ERROR_MB_ADDRESS_T;
|
||||
i2_cur_mb_addr++;
|
||||
|
||||
if(ps_cur_mb_info->u1_topmb && u1_mbaff)
|
||||
|
|
@ -1039,9 +1044,7 @@ WORD32 ih264d_parse_inter_slice_data_cabac(dec_struct_t * ps_dec,
|
|||
if(u1_decode_nmb)
|
||||
{
|
||||
|
||||
ret = ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs);
|
||||
u1_num_mbsNby2 = 0;
|
||||
|
||||
{
|
||||
|
|
@ -1065,11 +1068,9 @@ WORD32 ih264d_parse_inter_slice_data_cabac(dec_struct_t * ps_dec,
|
|||
}
|
||||
else
|
||||
{
|
||||
ret = ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs,
|
||||
u1_num_mbs_next, u1_tfr_n_mb,
|
||||
u1_end_of_row);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs,
|
||||
u1_num_mbs_next, u1_tfr_n_mb,
|
||||
u1_end_of_row);
|
||||
}
|
||||
|
||||
if(u1_tfr_n_mb)
|
||||
|
|
@ -1080,13 +1081,13 @@ WORD32 ih264d_parse_inter_slice_data_cabac(dec_struct_t * ps_dec,
|
|||
}
|
||||
}
|
||||
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
ps_dec->ps_parse_cur_slice->end_of_slice = 1;
|
||||
ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr
|
||||
|
||||
ps_dec->u4_num_mbs_cur_nmb = 0;
|
||||
ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr
|
||||
|
||||
- (u2_first_mb_in_slice << u1_mbaff);
|
||||
}
|
||||
return OK;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -1141,7 +1142,7 @@ WORD32 ih264d_parse_inter_slice_data_cavlc(dec_struct_t * ps_dec,
|
|||
UWORD32 u1_inter_mb_type;
|
||||
UWORD32 u1_deblk_mb_type;
|
||||
UWORD32 u1_mb_threshold;
|
||||
WORD32 ret;
|
||||
WORD32 ret = OK;
|
||||
|
||||
/******************************************************/
|
||||
/* Initialisations specific to B or P slice */
|
||||
|
|
@ -1162,11 +1163,8 @@ WORD32 ih264d_parse_inter_slice_data_cavlc(dec_struct_t * ps_dec,
|
|||
/******************************************************/
|
||||
/* Slice Level Initialisations */
|
||||
/******************************************************/
|
||||
i2_cur_mb_addr = u2_first_mb_in_slice;
|
||||
ps_dec->u1_qp = ps_slice->u1_slice_qp;
|
||||
ret = ih264d_update_qp(ps_dec, 0);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
ih264d_update_qp(ps_dec, 0);
|
||||
u1_mb_idx = ps_dec->u1_mb_idx;
|
||||
u1_num_mbs = u1_mb_idx;
|
||||
|
||||
|
|
@ -1181,14 +1179,17 @@ WORD32 ih264d_parse_inter_slice_data_cavlc(dec_struct_t * ps_dec,
|
|||
{
|
||||
UWORD8 u1_mb_type;
|
||||
|
||||
ps_dec->pv_prev_mb_parse_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
|
||||
|
||||
if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u2_max_mb_addr)
|
||||
{
|
||||
|
||||
ret = ERROR_MB_ADDRESS_T;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs;
|
||||
ps_dec->u4_num_mbs_cur_nmb = u1_num_mbs;
|
||||
|
||||
ps_cur_mb_info->u1_Mux = 0;
|
||||
ps_dec->u4_num_pmbair = (u1_num_mbs >> u1_mbaff);
|
||||
|
|
@ -1380,10 +1381,7 @@ WORD32 ih264d_parse_inter_slice_data_cavlc(dec_struct_t * ps_dec,
|
|||
//if(u1_dma_nby2mb)
|
||||
if(u1_decode_nmb)
|
||||
{
|
||||
|
||||
ret = ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs);
|
||||
u1_num_mbsNby2 = 0;
|
||||
|
||||
{
|
||||
|
|
@ -1409,11 +1407,9 @@ WORD32 ih264d_parse_inter_slice_data_cavlc(dec_struct_t * ps_dec,
|
|||
}
|
||||
else
|
||||
{
|
||||
ret = ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs,
|
||||
u1_num_mbs_next, u1_tfr_n_mb,
|
||||
u1_end_of_row);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs,
|
||||
u1_num_mbs_next, u1_tfr_n_mb,
|
||||
u1_end_of_row);
|
||||
}
|
||||
|
||||
if(u1_tfr_n_mb)
|
||||
|
|
@ -1425,15 +1421,420 @@ WORD32 ih264d_parse_inter_slice_data_cavlc(dec_struct_t * ps_dec,
|
|||
//ps_dec->ps_pred++;
|
||||
}
|
||||
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
ps_dec->ps_parse_cur_slice->end_of_slice = 1;
|
||||
ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr
|
||||
ps_dec->u4_num_mbs_cur_nmb = 0;
|
||||
ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr
|
||||
- (u2_first_mb_in_slice << u1_mbaff);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
WORD32 ih264d_mark_err_slice_skip(dec_struct_t * ps_dec,
|
||||
WORD32 num_mb_skip,
|
||||
UWORD8 u1_is_idr_slice,
|
||||
pocstruct_t *ps_cur_poc,
|
||||
WORD32 prev_slice_err)
|
||||
{
|
||||
WORD32 i2_cur_mb_addr;
|
||||
UWORD32 u1_num_mbs, u1_num_mbsNby2;
|
||||
UWORD32 u1_mb_idx = ps_dec->u1_mb_idx;
|
||||
UWORD32 i2_mb_skip_run;
|
||||
|
||||
UWORD32 u1_num_mbs_next, u1_end_of_row;
|
||||
const UWORD32 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs;
|
||||
UWORD32 u1_slice_end;
|
||||
UWORD32 u1_tfr_n_mb;
|
||||
UWORD32 u1_decode_nmb;
|
||||
dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
|
||||
dec_slice_params_t * ps_slice = ps_dec->ps_cur_slice;
|
||||
UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
|
||||
UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
|
||||
deblk_mb_t *ps_cur_deblk_mb;
|
||||
dec_mb_info_t *ps_cur_mb_info;
|
||||
parse_pmbarams_t *ps_parse_mb_data;
|
||||
UWORD32 u1_inter_mb_type;
|
||||
UWORD32 u1_deblk_mb_type;
|
||||
UWORD16 u2_total_mbs_coded;
|
||||
UWORD32 u1_mbaff = ps_slice->u1_mbaff_frame_flag;
|
||||
parse_part_params_t *ps_part_info;
|
||||
|
||||
if(prev_slice_err == 1)
|
||||
{
|
||||
// first slice - missing/header corruption
|
||||
if(u1_is_idr_slice)
|
||||
ps_dec->ps_cur_slice->u2_frame_num = 0;
|
||||
else
|
||||
ps_dec->ps_cur_slice->u2_frame_num++;
|
||||
|
||||
if(!ps_dec->u1_first_slice_in_stream)
|
||||
{
|
||||
ih264d_end_of_pic(ps_dec, u1_is_idr_slice,
|
||||
ps_dec->ps_cur_slice->u2_frame_num);
|
||||
ps_dec->s_cur_pic_poc.u2_frame_num =
|
||||
ps_dec->ps_cur_slice->u2_frame_num;
|
||||
}
|
||||
|
||||
{
|
||||
WORD32 i, j, poc = 0;
|
||||
|
||||
ps_dec->ps_cur_slice->u2_first_mb_in_slice = 0;
|
||||
|
||||
ps_dec->pf_mvpred = ih264d_mvpred_nonmbaff;
|
||||
ps_dec->p_form_mb_part_info = ih264d_form_mb_part_info_bp;
|
||||
ps_dec->p_motion_compensate = ih264d_motion_compensate_bp;
|
||||
ps_dec->ps_pps->ps_sps = ps_dec->ps_cur_sps;
|
||||
|
||||
if(ps_dec->ps_cur_pic != NULL)
|
||||
poc = ps_dec->ps_cur_pic->i4_poc + 2;
|
||||
|
||||
j = 0;
|
||||
for(i = 0; i < MAX_NUM_PIC_PARAMS; i++)
|
||||
if(ps_dec->ps_pps[i].u1_is_valid == TRUE)
|
||||
j = i;
|
||||
|
||||
ih264d_start_of_pic(ps_dec, poc, ps_cur_poc,
|
||||
ps_dec->ps_cur_slice->u2_frame_num,
|
||||
&ps_dec->ps_pps[j]);
|
||||
|
||||
ps_dec->ps_ref_pic_buf_lx[0][0]->u1_pic_buf_id = 0;
|
||||
|
||||
ps_dec->u4_output_present = 0;
|
||||
|
||||
{
|
||||
ih264d_get_next_display_field(ps_dec,
|
||||
ps_dec->ps_out_buffer,
|
||||
&(ps_dec->s_disp_op));
|
||||
/* If error code is non-zero then there is no buffer available for display,
|
||||
hence avoid format conversion */
|
||||
|
||||
if(0 != ps_dec->s_disp_op.u4_error_code)
|
||||
{
|
||||
ps_dec->u4_fmt_conv_cur_row = ps_dec->s_disp_frame_info.u4_y_ht;
|
||||
}
|
||||
else
|
||||
ps_dec->u4_output_present = 1;
|
||||
}
|
||||
|
||||
if(ps_dec->u1_separate_parse == 1)
|
||||
{
|
||||
if(ps_dec->u4_dec_thread_created == 0)
|
||||
{
|
||||
ithread_create(ps_dec->pv_dec_thread_handle, NULL,
|
||||
(void *)ih264d_decode_picture_thread,
|
||||
(void *)ps_dec);
|
||||
|
||||
ps_dec->u4_dec_thread_created = 1;
|
||||
}
|
||||
|
||||
if((ps_dec->u4_num_cores == 3) &&
|
||||
((ps_dec->u4_app_disable_deblk_frm == 0) || ps_dec->i1_recon_in_thread3_flag)
|
||||
&& (ps_dec->u4_bs_deblk_thread_created == 0))
|
||||
{
|
||||
ps_dec->u4_start_recon_deblk = 0;
|
||||
ithread_create(ps_dec->pv_bs_deblk_thread_handle, NULL,
|
||||
(void *)ih264d_recon_deblk_thread,
|
||||
(void *)ps_dec);
|
||||
ps_dec->u4_bs_deblk_thread_created = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Middle / last slice
|
||||
|
||||
dec_slice_struct_t *ps_parse_cur_slice;
|
||||
ps_parse_cur_slice = ps_dec->ps_dec_slice_buf + ps_dec->u2_cur_slice_num;
|
||||
|
||||
if(ps_dec->u1_slice_header_done
|
||||
&& ps_parse_cur_slice == ps_dec->ps_parse_cur_slice)
|
||||
{
|
||||
// Slice data corrupted
|
||||
u1_num_mbs = ps_dec->u4_num_mbs_cur_nmb;
|
||||
|
||||
if(u1_num_mbs)
|
||||
{
|
||||
ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
ps_cur_mb_info = ps_dec->ps_nmb_info - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_cur_mb_info = ps_dec->ps_nmb_info
|
||||
+ ps_dec->u4_num_mbs_prev_nmb - 1;
|
||||
}
|
||||
}
|
||||
|
||||
ps_dec->u2_mby = ps_cur_mb_info->u2_mby;
|
||||
ps_dec->u2_mbx = ps_cur_mb_info->u2_mbx;
|
||||
|
||||
ps_dec->u1_mb_ngbr_availablity =
|
||||
ps_cur_mb_info->u1_mb_ngbr_availablity;
|
||||
|
||||
// Going back 1 mb
|
||||
ps_dec->pv_parse_tu_coeff_data = ps_dec->pv_prev_mb_parse_tu_coeff_data;
|
||||
ps_dec->u2_cur_mb_addr--;
|
||||
ps_dec->i4_submb_ofst -= SUB_BLK_SIZE;
|
||||
|
||||
if(u1_num_mbs)
|
||||
{
|
||||
// Parse/decode N-MB left unparsed
|
||||
if (ps_dec->u1_pr_sl_type == P_SLICE
|
||||
|| ps_dec->u1_pr_sl_type == B_SLICE)
|
||||
{
|
||||
ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs);
|
||||
ps_dec->ps_part = ps_dec->ps_parse_part_params;
|
||||
}
|
||||
|
||||
u1_num_mbs_next = i2_pic_wdin_mbs - ps_dec->u2_mbx - 1;
|
||||
u1_end_of_row = (!u1_num_mbs_next)
|
||||
&& (!(u1_mbaff && (u1_num_mbs & 0x01)));
|
||||
u1_slice_end = 1;
|
||||
u1_tfr_n_mb = 1;
|
||||
ps_cur_mb_info->u1_end_of_slice = u1_slice_end;
|
||||
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
ih264d_parse_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs,
|
||||
u1_num_mbs_next, u1_tfr_n_mb, u1_end_of_row);
|
||||
ps_dec->ps_nmb_info += u1_num_mbs;
|
||||
}
|
||||
else
|
||||
{
|
||||
ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs,
|
||||
u1_num_mbs_next, u1_tfr_n_mb, u1_end_of_row);
|
||||
}
|
||||
|
||||
ps_dec->u1_mb_idx = 0;
|
||||
ps_dec->u4_num_mbs_cur_nmb = 0;
|
||||
}
|
||||
|
||||
if(ps_dec->u2_total_mbs_coded
|
||||
>= ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs)
|
||||
{
|
||||
ps_dec->u1_pic_decode_done = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Inserting new slice
|
||||
ps_dec->u2_cur_slice_num++;
|
||||
ps_dec->i2_prev_slice_mbx = ps_dec->u2_mbx;
|
||||
ps_dec->i2_prev_slice_mby = ps_dec->u2_mby;
|
||||
ps_dec->ps_parse_cur_slice++;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Slice missing / header corrupted
|
||||
ps_dec->ps_parse_cur_slice = ps_dec->ps_dec_slice_buf
|
||||
+ ps_dec->u2_cur_slice_num;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************/
|
||||
/* Initializations to new slice */
|
||||
/******************************************************/
|
||||
{
|
||||
WORD32 num_entries;
|
||||
WORD32 size;
|
||||
UWORD8 *pu1_buf;
|
||||
|
||||
num_entries = MIN(MAX_FRAMES, ps_dec->u4_num_ref_frames_at_init);
|
||||
num_entries = 2 * ((2 * num_entries) + 1);
|
||||
|
||||
size = num_entries * sizeof(void *);
|
||||
size += PAD_MAP_IDX_POC * sizeof(void *);
|
||||
|
||||
pu1_buf = (UWORD8 *)ps_dec->pv_map_ref_idx_to_poc_buf;
|
||||
pu1_buf += size * ps_dec->u2_cur_slice_num;
|
||||
ps_dec->ps_parse_cur_slice->ppv_map_ref_idx_to_poc = (volatile void **)pu1_buf;
|
||||
}
|
||||
|
||||
ps_dec->ps_cur_slice->u2_first_mb_in_slice = ps_dec->u2_total_mbs_coded << u1_mbaff;
|
||||
if(ps_dec->ps_cur_slice->u1_field_pic_flag)
|
||||
ps_dec->u2_prv_frame_num = ps_dec->ps_cur_slice->u2_frame_num;
|
||||
|
||||
ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice = ps_dec->u2_total_mbs_coded << u1_mbaff;
|
||||
ps_dec->ps_parse_cur_slice->u2_log2Y_crwd = ps_dec->ps_cur_slice->u2_log2Y_crwd;
|
||||
|
||||
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
ps_dec->ps_parse_cur_slice->pv_tu_coeff_data_start = ps_dec->pv_parse_tu_coeff_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_dec->pv_proc_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
|
||||
}
|
||||
|
||||
/******************************************************/
|
||||
/* Initializations specific to P slice */
|
||||
/******************************************************/
|
||||
u1_inter_mb_type = P_MB;
|
||||
u1_deblk_mb_type = D_INTER_MB;
|
||||
|
||||
ps_dec->ps_cur_slice->u1_slice_type = P_SLICE;
|
||||
ps_dec->ps_parse_cur_slice->slice_type = P_SLICE;
|
||||
ps_dec->pf_mvpred_ref_tfr_nby2mb = ih264d_mv_pred_ref_tfr_nby2_pmb;
|
||||
ps_dec->ps_part = ps_dec->ps_parse_part_params;
|
||||
|
||||
/******************************************************/
|
||||
/* Parsing / decoding the slice */
|
||||
/******************************************************/
|
||||
ps_dec->u4_first_slice_in_pic = 0;
|
||||
ps_dec->u1_first_slice_in_stream = 0;
|
||||
ps_dec->u1_slice_header_done = 2;
|
||||
ps_dec->u1_qp = ps_slice->u1_slice_qp;
|
||||
ih264d_update_qp(ps_dec, 0);
|
||||
u1_mb_idx = ps_dec->u1_mb_idx;
|
||||
ps_parse_mb_data = ps_dec->ps_parse_mb_data;
|
||||
u1_num_mbs = u1_mb_idx;
|
||||
|
||||
u1_slice_end = 0;
|
||||
u1_tfr_n_mb = 0;
|
||||
u1_decode_nmb = 0;
|
||||
u1_num_mbsNby2 = 0;
|
||||
i2_cur_mb_addr = ps_dec->u2_total_mbs_coded;
|
||||
i2_mb_skip_run = num_mb_skip;
|
||||
|
||||
while(!u1_slice_end)
|
||||
{
|
||||
UWORD8 u1_mb_type;
|
||||
|
||||
if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u2_max_mb_addr)
|
||||
break;
|
||||
|
||||
ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs;
|
||||
ps_dec->u4_num_mbs_cur_nmb = u1_num_mbs;
|
||||
|
||||
ps_cur_mb_info->u1_Mux = 0;
|
||||
ps_dec->u4_num_pmbair = (u1_num_mbs >> u1_mbaff);
|
||||
ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u1_num_mbs;
|
||||
|
||||
ps_cur_mb_info->u1_end_of_slice = 0;
|
||||
|
||||
/* Storing Default partition info */
|
||||
ps_parse_mb_data->u1_num_part = 1;
|
||||
ps_parse_mb_data->u1_isI_mb = 0;
|
||||
|
||||
/**************************************************************/
|
||||
/* Get the required information for decoding of MB */
|
||||
/**************************************************************/
|
||||
/* mb_x, mb_y, neighbor availablity, */
|
||||
if (u1_mbaff)
|
||||
ih264d_get_mb_info_cavlc_mbaff(ps_dec, i2_cur_mb_addr, ps_cur_mb_info, i2_mb_skip_run);
|
||||
else
|
||||
ih264d_get_mb_info_cavlc_nonmbaff(ps_dec, i2_cur_mb_addr, ps_cur_mb_info, i2_mb_skip_run);
|
||||
|
||||
/* Set the deblocking parameters for this MB */
|
||||
if(ps_dec->u4_app_disable_deblk_frm == 0)
|
||||
{
|
||||
ih264d_set_deblocking_parameters(ps_cur_deblk_mb, ps_slice,
|
||||
ps_dec->u1_mb_ngbr_availablity,
|
||||
ps_dec->u1_cur_mb_fld_dec_flag);
|
||||
}
|
||||
|
||||
/* Set appropriate flags in ps_cur_mb_info and ps_dec */
|
||||
ps_dec->i1_prev_mb_qp_delta = 0;
|
||||
ps_dec->u1_sub_mb_num = 0;
|
||||
ps_cur_mb_info->u1_mb_type = MB_SKIP;
|
||||
ps_cur_mb_info->u1_mb_mc_mode = PRED_16x16;
|
||||
ps_cur_mb_info->u1_cbp = 0;
|
||||
|
||||
/* Storing Skip partition info */
|
||||
ps_part_info = ps_dec->ps_part;
|
||||
ps_part_info->u1_is_direct = PART_DIRECT_16x16;
|
||||
ps_part_info->u1_sub_mb_num = 0;
|
||||
ps_dec->ps_part++;
|
||||
|
||||
/* Update Nnzs */
|
||||
ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CAVLC);
|
||||
|
||||
ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type;
|
||||
ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type;
|
||||
|
||||
i2_mb_skip_run--;
|
||||
|
||||
ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp;
|
||||
|
||||
if (u1_mbaff)
|
||||
{
|
||||
ih264d_update_mbaff_left_nnz(ps_dec, ps_cur_mb_info);
|
||||
}
|
||||
|
||||
/**************************************************************/
|
||||
/* Get next Macroblock address */
|
||||
/**************************************************************/
|
||||
i2_cur_mb_addr++;
|
||||
|
||||
u1_num_mbs++;
|
||||
ps_dec->u2_total_mbs_coded++;
|
||||
u1_num_mbsNby2++;
|
||||
ps_parse_mb_data++;
|
||||
|
||||
/****************************************************************/
|
||||
/* Check for End Of Row and other flags that determine when to */
|
||||
/* do DMA setup for N/2-Mb, Decode for N-Mb, and Transfer for */
|
||||
/* N-Mb */
|
||||
/****************************************************************/
|
||||
u1_num_mbs_next = i2_pic_wdin_mbs - ps_dec->u2_mbx - 1;
|
||||
u1_end_of_row = (!u1_num_mbs_next) && (!(u1_mbaff && (u1_num_mbs & 0x01)));
|
||||
u1_slice_end = !i2_mb_skip_run;
|
||||
u1_tfr_n_mb = (u1_num_mbs == ps_dec->u1_recon_mb_grp) || u1_end_of_row
|
||||
|| u1_slice_end;
|
||||
u1_decode_nmb = u1_tfr_n_mb || u1_slice_end;
|
||||
ps_cur_mb_info->u1_end_of_slice = u1_slice_end;
|
||||
|
||||
if(u1_decode_nmb)
|
||||
{
|
||||
ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs);
|
||||
u1_num_mbsNby2 = 0;
|
||||
|
||||
ps_parse_mb_data = ps_dec->ps_parse_mb_data;
|
||||
ps_dec->ps_part = ps_dec->ps_parse_part_params;
|
||||
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
ih264d_parse_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs,
|
||||
u1_num_mbs_next, u1_tfr_n_mb, u1_end_of_row);
|
||||
ps_dec->ps_nmb_info += u1_num_mbs;
|
||||
}
|
||||
else
|
||||
{
|
||||
ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next,
|
||||
u1_tfr_n_mb, u1_end_of_row);
|
||||
}
|
||||
|
||||
if(u1_tfr_n_mb)
|
||||
u1_num_mbs = 0;
|
||||
u1_mb_idx = u1_num_mbs;
|
||||
ps_dec->u1_mb_idx = u1_num_mbs;
|
||||
}
|
||||
}
|
||||
|
||||
ps_dec->u4_num_mbs_cur_nmb = 0;
|
||||
ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr
|
||||
- ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice;
|
||||
|
||||
H264_DEC_DEBUG_PRINT("Mbs in slice: %d\n", ps_dec->ps_cur_slice->u4_mbs_in_slice);
|
||||
|
||||
ps_dec->u2_cur_slice_num++;
|
||||
ps_dec->i2_prev_slice_mbx = ps_dec->u2_mbx;
|
||||
ps_dec->i2_prev_slice_mby = ps_dec->u2_mby;
|
||||
|
||||
if(ps_dec->u2_total_mbs_coded
|
||||
>= ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs)
|
||||
{
|
||||
ps_dec->u1_pic_decode_done = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -1720,15 +2121,12 @@ WORD32 ih264d_parse_pslice(dec_struct_t *ps_dec, UWORD16 u2_first_mb_in_slice)
|
|||
ps_cur_slice->i1_slice_beta_offset = 0;
|
||||
}
|
||||
|
||||
DATA_SYNC();
|
||||
ps_dec->ps_parse_cur_slice->slice_header_done = 2;
|
||||
ps_dec->u1_slice_header_done = 2;
|
||||
|
||||
if(ps_pps->u1_entropy_coding_mode)
|
||||
{
|
||||
SWITCHOFFTRACE; SWITCHONTRACECABAC;
|
||||
ps_dec->pf_parse_inter_slice = ih264d_parse_inter_slice_data_cabac;
|
||||
if(ps_dec->ps_parse_cur_slice->u2_error_flag == 1)
|
||||
return 0;
|
||||
ps_dec->pf_parse_inter_mb = ih264d_parse_pmb_cabac;
|
||||
ih264d_init_cabac_contexts(P_SLICE, ps_dec);
|
||||
|
||||
|
|
|
|||
|
|
@ -195,27 +195,25 @@ WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec,
|
|||
ps_dec->i1_prev_mb_qp_delta = 0;
|
||||
ps_dec->i1_next_ctxt_idx = 0;
|
||||
|
||||
ps_dec->u4_mb_level_deblk = 0;
|
||||
|
||||
/* Disable MB_LEVEL_DEBLK if deblock thread is enabled */
|
||||
if(ps_dec->u4_num_cores >= 3)
|
||||
{
|
||||
ps_dec->u4_mb_level_deblk = 0;
|
||||
}
|
||||
ps_dec->u4_nmb_deblk = 0;
|
||||
if(ps_dec->u4_num_cores == 1)
|
||||
ps_dec->u4_nmb_deblk = 1;
|
||||
|
||||
|
||||
|
||||
if(ps_seq->u1_mb_aff_flag == 1)
|
||||
{
|
||||
ps_dec->u4_mb_level_deblk = 0;
|
||||
ps_dec->u4_nmb_deblk = 0;
|
||||
if(ps_dec->u4_num_cores > 2)
|
||||
ps_dec->u4_num_cores = 2;
|
||||
}
|
||||
if(ps_dec->u4_mb_level_deblk == 1)
|
||||
ps_dec->u4_use_intrapred_line_copy = 1;
|
||||
else
|
||||
|
||||
ps_dec->u4_use_intrapred_line_copy = 0;
|
||||
|
||||
if((ps_dec->u4_num_cores >= 3) && (ps_seq->u1_mb_aff_flag == 0))
|
||||
|
||||
|
||||
if (ps_seq->u1_mb_aff_flag == 0)
|
||||
{
|
||||
ps_dec->u4_use_intrapred_line_copy = 1;
|
||||
}
|
||||
|
|
@ -308,7 +306,6 @@ WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec,
|
|||
}
|
||||
}
|
||||
|
||||
ps_dec->u1_first_nal_in_pic = 0;
|
||||
if(ps_dec->u1_init_dec_flag && ps_dec->s_prev_seq_params.u1_eoseq_pending)
|
||||
{
|
||||
/* Reset the decoder picture buffers */
|
||||
|
|
@ -351,14 +348,13 @@ WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec,
|
|||
UWORD16 pic_ht = ps_dec->u4_height_at_init;
|
||||
UWORD32 num_mbs;
|
||||
|
||||
if((NULL != ps_dec->ps_sps) && (1 == (ps_dec->ps_sps->u1_is_valid)))
|
||||
if((NULL != ps_dec->ps_cur_sps) && (1 == (ps_dec->ps_cur_sps->u1_is_valid)))
|
||||
{
|
||||
pic_wd = ps_dec->u2_pic_wd;
|
||||
pic_ht = ps_dec->u2_pic_ht;
|
||||
}
|
||||
num_mbs = (pic_wd * pic_ht) >> 8;
|
||||
|
||||
ps_dec->u4_start_frame_decode = 0;
|
||||
if(ps_dec->pu1_dec_mb_map)
|
||||
{
|
||||
memset((void *)ps_dec->pu1_dec_mb_map, 0, num_mbs);
|
||||
|
|
@ -377,17 +373,10 @@ WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec,
|
|||
}
|
||||
|
||||
}
|
||||
if(ps_dec->u4_first_slice_in_pic == 1)
|
||||
{
|
||||
ps_dec->ps_parse_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
|
||||
ps_dec->ps_decode_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
|
||||
ps_dec->ps_computebs_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
|
||||
}
|
||||
ps_dec->ps_parse_cur_slice->slice_header_done = 0;
|
||||
ps_dec->ps_parse_cur_slice->last_slice_in_frame = 0;
|
||||
ps_dec->ps_parse_cur_slice->u4_num_mbs_done_in_slice = 0;
|
||||
|
||||
ps_dec->ps_parse_cur_slice->u2_error_flag = 0;
|
||||
ps_dec->ps_parse_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
|
||||
ps_dec->ps_decode_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
|
||||
ps_dec->ps_computebs_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
|
||||
|
||||
/* Initialize all the HP toolsets to zero */
|
||||
ps_dec->s_high_profile.u1_scaling_present = 0;
|
||||
|
|
@ -449,6 +438,12 @@ WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec,
|
|||
ps_cur_pic->pu1_col_zero_flag = (UWORD8 *)ps_col_mv->pv_col_zero_flag;
|
||||
ps_cur_pic->ps_mv = (mv_pred_t *)ps_col_mv->pv_mv;
|
||||
ps_dec->au1_pic_buf_ref_flag[cur_pic_buf_id] = 0;
|
||||
if(ps_dec->u1_first_slice_in_stream)
|
||||
{
|
||||
/*make first entry of list0 point to cur pic,so that if first Islice is in error, ref pic struct will have valid entries*/
|
||||
ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_init_dpb[0];
|
||||
*(ps_dec->ps_dpb_mgr->ps_init_dpb[0][0]) = *ps_cur_pic;
|
||||
}
|
||||
|
||||
if(!ps_dec->ps_cur_pic)
|
||||
{
|
||||
|
|
@ -549,20 +544,6 @@ WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec,
|
|||
|
||||
ps_dec->ps_cur_pic->u1_picturetype |= (ps_cur_slice->u1_mbaff_frame_flag
|
||||
<< 2);
|
||||
if(ps_cur_slice->u1_mbaff_frame_flag)
|
||||
{
|
||||
ps_dec->u2_mb_group_cols_y = ((ps_dec->u1_recon_mb_grp >> 1) << 4) + 8;
|
||||
ps_dec->u2_mb_group_cols_cr = ((ps_dec->u1_recon_mb_grp >> 1) << 3) + 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_dec->u2_mb_group_cols_y = (ps_dec->u1_recon_mb_grp << 4) + 8;
|
||||
ps_dec->u2_mb_group_cols_cr = (ps_dec->u1_recon_mb_grp << 3) + 8;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ps_dec->ps_cur_mb_row = ps_dec->ps_nbr_mb_row; //[0];
|
||||
ps_dec->ps_cur_mb_row++; //Increment by 1 ,so that left mb will always be valid
|
||||
|
|
@ -573,8 +554,6 @@ WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec,
|
|||
- ps_dec->ps_cur_sps->u1_frame_mbs_only_flag));
|
||||
ps_dec->ps_top_mb_row++; //Increment by 1 ,so that left mb will always be valid
|
||||
|
||||
ps_dec->u2_mb_group_cols_y1 = ps_dec->u2_mb_group_cols_y;
|
||||
ps_dec->u2_mb_group_cols_cr1 = ps_dec->u2_mb_group_cols_cr;
|
||||
ps_dec->pu1_y = ps_dec->pu1_y_scratch[0];
|
||||
ps_dec->pu1_u = ps_dec->pu1_u_scratch[0];
|
||||
ps_dec->pu1_v = ps_dec->pu1_v_scratch[0];
|
||||
|
|
@ -731,12 +710,31 @@ WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec,
|
|||
ps_seq->u1_direct_8x8_inference_flag;
|
||||
ps_dec->s_high_profile.s_cavlc_ctxt = ps_dec->s_cavlc_ctxt;
|
||||
|
||||
ps_dec->i1_recon_in_thread3_flag = 1;
|
||||
ps_dec->ps_frame_buf_ip_recon = &ps_dec->s_tran_addrecon;
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
memcpy(&ps_dec->s_tran_addrecon_parse, &ps_dec->s_tran_addrecon,
|
||||
sizeof(tfr_ctxt_t));
|
||||
if(ps_dec->u4_num_cores >= 3 && ps_dec->i1_recon_in_thread3_flag)
|
||||
{
|
||||
memcpy(&ps_dec->s_tran_iprecon, &ps_dec->s_tran_addrecon,
|
||||
sizeof(tfr_ctxt_t));
|
||||
ps_dec->ps_frame_buf_ip_recon = &ps_dec->s_tran_iprecon;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ih264d_init_deblk_tfr_ctxt(ps_dec,&(ps_dec->s_pad_mgr), &(ps_dec->s_tran_addrecon),
|
||||
ps_dec->u2_frm_wd_in_mbs, 0);
|
||||
|
||||
ps_dec->ps_cur_deblk_mb = ps_dec->ps_deblk_pic;
|
||||
ps_dec->u4_cur_deblk_mb_num = 0;
|
||||
|
||||
ps_dec->u4_deblk_mb_x = 0;
|
||||
ps_dec->u4_deblk_mb_y = 0;
|
||||
|
||||
|
||||
H264_MUTEX_UNLOCK(&ps_dec->process_disp_mutex);
|
||||
return OK;
|
||||
}
|
||||
|
|
@ -963,7 +961,7 @@ WORD32 ih264d_end_of_pic(dec_struct_t *ps_dec,
|
|||
dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice;
|
||||
WORD32 ret;
|
||||
|
||||
ps_dec->u1_first_nal_in_pic = 1;
|
||||
ps_dec->u4_first_slice_in_pic = 1;
|
||||
ps_dec->u1_first_pb_nal_in_pic = 1;
|
||||
ps_dec->u2_mbx = 0xffff;
|
||||
ps_dec->u2_mby = 0;
|
||||
|
|
@ -1060,28 +1058,15 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
|
||||
WORD8 i1_is_end_of_poc;
|
||||
|
||||
WORD32 ret;
|
||||
WORD32 ret, end_of_frame;
|
||||
WORD32 prev_slice_err, num_mb_skipped;
|
||||
UWORD8 u1_mbaff;
|
||||
pocstruct_t *ps_cur_poc;
|
||||
|
||||
UWORD32 u4_temp;
|
||||
WORD32 i_temp;
|
||||
UWORD32 u4_call_end_of_pic = 0;
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Decode Portion of the Slice header */
|
||||
/* This is done to detect end of picture */
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
if(ps_dec->u4_first_slice_in_pic == 0)
|
||||
{
|
||||
volatile dec_slice_struct_t *ps_next_slice;
|
||||
|
||||
ps_next_slice = ps_dec->ps_parse_cur_slice + 1;
|
||||
|
||||
/*Reset the ready u4_flag and then increment*/
|
||||
ps_next_slice->slice_header_done = 0;
|
||||
DATA_SYNC();
|
||||
ps_dec->ps_parse_cur_slice++;
|
||||
}
|
||||
|
||||
/* read FirstMbInSlice and slice type*/
|
||||
ps_dec->ps_dpb_cmds->u1_dpb_commands_read_slc = 0;
|
||||
u2_first_mb_in_slice = ih264d_uev(pu4_bitstrm_ofst,
|
||||
|
|
@ -1135,7 +1120,7 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
ps_dec->i4_dec_skip_mode = IVD_SKIP_NONE;
|
||||
}
|
||||
else if((I_SLICE == u1_slice_type)
|
||||
&& (1 >= ps_dec->ps_sps->u1_num_ref_frames))
|
||||
&& (1 >= ps_dec->ps_cur_sps->u1_num_ref_frames))
|
||||
{
|
||||
skip = 0;
|
||||
|
||||
|
|
@ -1295,14 +1280,13 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
u1_redundant_pic_cnt = u4_temp;
|
||||
COPYTHECONTEXT("SH: redundant_pic_cnt", u1_redundant_pic_cnt);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Check if the slice is part of new picture if so do End of Pic */
|
||||
/* processing. */
|
||||
/* Check if the slice is part of new picture */
|
||||
/*--------------------------------------------------------------------*/
|
||||
i1_is_end_of_poc = 0;
|
||||
if(!ps_dec->u1_first_nal_in_pic)
|
||||
if(!ps_dec->u1_first_slice_in_stream)
|
||||
{
|
||||
UWORD8 uc_mbs_exceed = 0;
|
||||
i1_is_end_of_poc = ih264d_is_end_of_pic(u2_frame_num, u1_nal_ref_idc,
|
||||
&s_tmp_poc, &ps_dec->s_cur_pic_poc,
|
||||
ps_cur_slice, u1_pic_order_cnt_type,
|
||||
|
|
@ -1310,6 +1294,113 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
u1_field_pic_flag,
|
||||
u1_bottom_field_flag);
|
||||
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Check for error in slice and parse the missing/corrupted MB's */
|
||||
/* as skip-MB's in an inserted P-slice */
|
||||
/*--------------------------------------------------------------------*/
|
||||
u1_mbaff = ps_seq->u1_mb_aff_flag && (!u1_field_pic_flag);
|
||||
prev_slice_err = 0;
|
||||
|
||||
if(i1_is_end_of_poc || ps_dec->u1_first_slice_in_stream)
|
||||
{
|
||||
if(u2_frame_num != ps_dec->u2_prv_frame_num
|
||||
&& ps_dec->u1_top_bottom_decoded != 0
|
||||
&& ps_dec->u1_top_bottom_decoded
|
||||
!= (TOP_FIELD_ONLY | BOT_FIELD_ONLY))
|
||||
{
|
||||
if(ps_dec->u4_first_slice_in_pic)
|
||||
{
|
||||
// first slice - dangling field
|
||||
prev_slice_err = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// last slice - dangling field
|
||||
prev_slice_err = 2;
|
||||
}
|
||||
|
||||
if(ps_dec->u1_top_bottom_decoded ==TOP_FIELD_ONLY)
|
||||
ps_cur_slice->u1_bottom_field_flag = 1;
|
||||
else
|
||||
ps_cur_slice->u1_bottom_field_flag = 0;
|
||||
|
||||
num_mb_skipped = (ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs)
|
||||
- ps_dec->u2_total_mbs_coded;
|
||||
ps_cur_poc = &ps_dec->s_cur_pic_poc;
|
||||
|
||||
u1_is_idr_slice = ps_cur_slice->u1_nal_unit_type == IDR_SLICE_NAL;
|
||||
}
|
||||
else if(ps_dec->u4_first_slice_in_pic)
|
||||
{
|
||||
if(u2_first_mb_in_slice > 0)
|
||||
{
|
||||
// first slice - missing/header corruption
|
||||
prev_slice_err = 1;
|
||||
num_mb_skipped = u2_first_mb_in_slice << u1_mbaff;
|
||||
ps_cur_poc = &s_tmp_poc;
|
||||
|
||||
// initializing slice parameters
|
||||
ps_cur_slice->u4_idr_pic_id = u4_idr_pic_id;
|
||||
ps_cur_slice->u1_field_pic_flag = u1_field_pic_flag;
|
||||
ps_cur_slice->u1_bottom_field_flag = u1_bottom_field_flag;
|
||||
ps_cur_slice->i4_pic_order_cnt_lsb =
|
||||
s_tmp_poc.i4_pic_order_cnt_lsb;
|
||||
ps_cur_slice->u1_nal_unit_type = u1_nal_unit_type;
|
||||
ps_cur_slice->u1_redundant_pic_cnt = u1_redundant_pic_cnt;
|
||||
ps_cur_slice->u1_nal_ref_idc = u1_nal_ref_idc;
|
||||
ps_cur_slice->u1_pic_order_cnt_type = u1_pic_order_cnt_type;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// last slice - missing/corruption
|
||||
prev_slice_err = 2;
|
||||
num_mb_skipped = (ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs)
|
||||
- ps_dec->u2_total_mbs_coded;
|
||||
ps_cur_poc = &s_tmp_poc;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if((u2_first_mb_in_slice << u1_mbaff) > ps_dec->u2_total_mbs_coded)
|
||||
{
|
||||
// previous slice - missing/corruption
|
||||
prev_slice_err = 2;
|
||||
num_mb_skipped = (u2_first_mb_in_slice << u1_mbaff)
|
||||
- ps_dec->u2_total_mbs_coded;
|
||||
ps_cur_poc = &s_tmp_poc;
|
||||
}
|
||||
else if((u2_first_mb_in_slice << u1_mbaff) < ps_dec->u2_total_mbs_coded)
|
||||
{
|
||||
return ERROR_CORRUPTED_SLICE;
|
||||
}
|
||||
}
|
||||
|
||||
if(prev_slice_err)
|
||||
{
|
||||
end_of_frame = ih264d_mark_err_slice_skip(ps_dec,num_mb_skipped,u1_is_idr_slice,ps_cur_poc,prev_slice_err);
|
||||
|
||||
if(end_of_frame)
|
||||
{
|
||||
// return if all MBs in frame are parsed
|
||||
return ERROR_IN_LAST_SLICE_OF_PIC;
|
||||
}
|
||||
i1_is_end_of_poc = 0;
|
||||
}
|
||||
|
||||
if (ps_dec->u4_first_slice_in_pic == 0)
|
||||
ps_dec->ps_parse_cur_slice++;
|
||||
|
||||
ps_dec->u1_slice_header_done = 0;
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* If the slice is part of new picture, do End of Pic processing. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
if(!ps_dec->u1_first_slice_in_stream)
|
||||
{
|
||||
UWORD8 uc_mbs_exceed = 0;
|
||||
/*since we support only Full frame decode, every new process should
|
||||
* process a new pic
|
||||
*/
|
||||
|
|
@ -1347,39 +1438,14 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
}
|
||||
else
|
||||
{
|
||||
if((ps_dec->u2_total_mbs_coded
|
||||
< (ps_dec->ps_cur_sps->u2_max_mb_addr + 1)))
|
||||
{
|
||||
H264_DEC_DEBUG_PRINT("Hello\n");
|
||||
ps_dec->u2_total_mbs_coded =
|
||||
ps_dec->ps_cur_sps->u2_max_mb_addr + 1;
|
||||
ps_dec->u1_first_nal_in_pic = 1;
|
||||
ps_dec->u1_first_pb_nal_in_pic = 1;
|
||||
return ERROR_END_OF_FRAME_EXPECTED_T;
|
||||
/*if (ps_cur_slice->u1_field_pic_flag &&
|
||||
((TOP_FIELD_ONLY | BOT_FIELD_ONLY) == ps_dec->u1_top_bottom_decoded))
|
||||
{
|
||||
ps_cur_slice->u1_end_of_frame_signal = 0;
|
||||
}*/
|
||||
}
|
||||
ret = ih264d_end_of_pic(ps_dec, u1_is_idr_slice, u2_frame_num);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(ps_dec->u4_first_slice_in_pic == 1)
|
||||
{
|
||||
/*If the first slice in decode api is not from a new picture,
|
||||
* we will return error code ,as we don't support partial
|
||||
frame decode*/
|
||||
return ERROR_PIC_NUM_IS_REPEATED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ps_cur_slice->u1_end_of_frame_signal = 0;
|
||||
if(u1_field_pic_flag)
|
||||
{
|
||||
|
|
@ -1447,7 +1513,7 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
ps_dec->ps_cur_pic->i4_poc = i4_temp_poc;
|
||||
ps_dec->ps_cur_pic->i4_avg_poc = i4_temp_poc;
|
||||
}
|
||||
if(ps_dec->u1_first_nal_in_pic)
|
||||
if(ps_dec->u4_first_slice_in_pic)
|
||||
{
|
||||
ret = ih264d_decode_pic_order_cnt(u1_is_idr_slice, u2_frame_num,
|
||||
&ps_dec->s_prev_pic_poc,
|
||||
|
|
@ -1515,7 +1581,7 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
ps_dec->pf_mvpred = ih264d_mvpred_nonmbaff;
|
||||
}
|
||||
|
||||
if(ps_dec->u1_first_nal_in_pic)
|
||||
if(ps_dec->u4_first_slice_in_pic)
|
||||
{
|
||||
ret = ih264d_start_of_pic(ps_dec, i4_poc, &s_tmp_poc, u2_frame_num, ps_pps);
|
||||
if(ret != OK)
|
||||
|
|
@ -1523,7 +1589,6 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
|
||||
ps_dec->u4_output_present = 0;
|
||||
|
||||
if(1 == ps_dec->u4_fmt_conv_in_process)
|
||||
{
|
||||
ih264d_get_next_display_field(ps_dec,
|
||||
ps_dec->ps_out_buffer,
|
||||
|
|
@ -1534,8 +1599,6 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
if(0 != ps_dec->s_disp_op.u4_error_code)
|
||||
{
|
||||
ps_dec->u4_fmt_conv_cur_row = ps_dec->s_disp_frame_info.u4_y_ht;
|
||||
ps_dec->as_fmt_conv_part[0].u4_flag = 0;
|
||||
ps_dec->as_fmt_conv_part[1].u4_flag = 0;
|
||||
}
|
||||
else
|
||||
ps_dec->u4_output_present = 1;
|
||||
|
|
@ -1551,12 +1614,13 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
ps_dec->u4_dec_thread_created = 1;
|
||||
}
|
||||
|
||||
if((ps_dec->u4_num_cores == 3) && (ps_dec->u4_app_disable_deblk_frm == 0)
|
||||
if((ps_dec->u4_num_cores == 3) &&
|
||||
((ps_dec->u4_app_disable_deblk_frm == 0) || ps_dec->i1_recon_in_thread3_flag)
|
||||
&& (ps_dec->u4_bs_deblk_thread_created == 0))
|
||||
{
|
||||
ps_dec->u4_start_bs_deblk = 0;
|
||||
ps_dec->u4_start_recon_deblk = 0;
|
||||
ithread_create(ps_dec->pv_bs_deblk_thread_handle, NULL,
|
||||
(void *)ih264d_computebs_deblk_thread,
|
||||
(void *)ih264d_recon_deblk_thread,
|
||||
(void *)ps_dec);
|
||||
ps_dec->u4_bs_deblk_thread_created = 1;
|
||||
}
|
||||
|
|
@ -1566,7 +1630,7 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
|
||||
/* INITIALIZATION of fn ptrs for MC and formMbPartInfo functions */
|
||||
{
|
||||
UWORD8 uc_nofield_nombaff = 1; // = ((ps_dec->ps_sps->u1_profile_idc == 0x42) || (u1_slice_type == I_SLICE));
|
||||
UWORD8 uc_nofield_nombaff;
|
||||
|
||||
|
||||
|
||||
|
|
@ -1706,17 +1770,6 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
ps_trns_addr->pu1_mb_u = ps_trns_addr->pu1_dest_u;
|
||||
ps_trns_addr->pu1_mb_v = ps_trns_addr->pu1_dest_v;
|
||||
|
||||
if(ps_dec->u4_mb_level_deblk == 1)
|
||||
{
|
||||
/*If it is not the first mb in row,the previous MB which needs to be deblocked
|
||||
* as there is delay of 1 MB*/
|
||||
if(u2_mb_x != 0)
|
||||
{
|
||||
ps_trns_addr->pu1_mb_y -= MB_SIZE;
|
||||
ps_trns_addr->pu1_mb_u -= BLK8x8SIZE * YUV420SP_FACTOR;
|
||||
ps_trns_addr->pu1_mb_v -= BLK8x8SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
// assign the deblock structure pointers to start of slice
|
||||
if(ps_dec->u1_separate_parse == 1)
|
||||
|
|
@ -1726,7 +1779,6 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
}
|
||||
else
|
||||
{
|
||||
if(ps_dec->u4_mb_level_deblk == 0)
|
||||
ps_dec->ps_deblk_mbn = ps_dec->ps_deblk_pic
|
||||
+ (u2_first_mb_in_slice << u1_mb_aff);
|
||||
}
|
||||
|
|
@ -1755,12 +1807,6 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
// assign the deblock structure pointers to start of slice
|
||||
ps_dec->u2_cur_mb_addr = 0;
|
||||
ps_dec->ps_deblk_mbn = ps_dec->ps_deblk_pic;
|
||||
if(ps_dec->u4_mb_level_deblk == 1)
|
||||
{
|
||||
ps_dec->ps_deblk_mbn_curr = ps_dec->ps_deblk_mbn;
|
||||
ps_dec->ps_deblk_mbn_prev = ps_dec->ps_deblk_mbn
|
||||
+ ps_dec->u1_recon_mb_grp;
|
||||
}
|
||||
ps_dec->ps_mv_cur = ps_dec->s_cur_pic.ps_mv;
|
||||
ps_trns_addr->pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1;
|
||||
ps_trns_addr->pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2;
|
||||
|
|
@ -1789,24 +1835,13 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
ps_dec->u1_B = (u1_slice_type == B_SLICE);
|
||||
ps_dec->u4_next_mb_skip = 0;
|
||||
|
||||
ps_dec->ps_parse_cur_slice->u4_num_mbs_done_in_slice = 0;
|
||||
ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice =
|
||||
ps_dec->ps_cur_slice->u2_first_mb_in_slice;
|
||||
ps_dec->ps_parse_cur_slice->slice_type =
|
||||
ps_dec->ps_cur_slice->u1_slice_type;
|
||||
ps_dec->ps_parse_cur_slice->end_of_slice = 0;
|
||||
ps_dec->ps_parse_cur_slice->last_slice_in_frame = 0;
|
||||
|
||||
|
||||
/*set to zero to indicate a valid slice has been decoded*/
|
||||
ps_dec->u4_first_slice_in_pic = 0;
|
||||
|
||||
ps_dec->u4_start_frame_decode = 1;
|
||||
|
||||
|
||||
ps_dec->u4_start_bs_deblk = 1;
|
||||
|
||||
ps_dec->ps_parse_cur_slice->u2_error_flag = 0;
|
||||
ps_dec->u4_start_recon_deblk = 1;
|
||||
{
|
||||
WORD32 num_entries;
|
||||
WORD32 size;
|
||||
|
|
@ -1820,16 +1855,24 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
|
||||
pu1_buf = (UWORD8 *)ps_dec->pv_map_ref_idx_to_poc_buf;
|
||||
pu1_buf += size * ps_dec->u2_cur_slice_num;
|
||||
ps_dec->ps_parse_cur_slice->ppv_map_ref_idx_to_poc = (volatile void **)pu1_buf;
|
||||
ps_dec->ps_parse_cur_slice->ppv_map_ref_idx_to_poc = ( void *)pu1_buf;
|
||||
}
|
||||
|
||||
if(ps_dec->u1_separate_parse)
|
||||
{
|
||||
ps_dec->ps_parse_cur_slice->pv_tu_coeff_data_start = ps_dec->pv_parse_tu_coeff_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_dec->pv_proc_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
|
||||
}
|
||||
|
||||
ps_dec->pu4_wt_ofsts = ps_dec->pu4_wts_ofsts_mat;
|
||||
if(u1_slice_type == I_SLICE)
|
||||
{
|
||||
ps_dec->ps_cur_pic->u4_pack_slc_typ |= I_SLC_BIT;
|
||||
|
||||
ret = ih264d_parse_islice(ps_dec, u2_first_mb_in_slice);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
|
||||
if(ps_dec->i4_pic_type != B_SLICE && ps_dec->i4_pic_type != P_SLICE)
|
||||
ps_dec->i4_pic_type = I_SLICE;
|
||||
|
|
@ -1839,8 +1882,6 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
{
|
||||
ps_dec->ps_cur_pic->u4_pack_slc_typ |= P_SLC_BIT;
|
||||
ret = ih264d_parse_pslice(ps_dec, u2_first_mb_in_slice);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
ps_dec->u1_pr_sl_type = u1_slice_type;
|
||||
if(ps_dec->i4_pic_type != B_SLICE)
|
||||
ps_dec->i4_pic_type = P_SLICE;
|
||||
|
|
@ -1849,20 +1890,27 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
{
|
||||
ps_dec->ps_cur_pic->u4_pack_slc_typ |= B_SLC_BIT;
|
||||
ret = ih264d_parse_bslice(ps_dec, u2_first_mb_in_slice);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
ps_dec->u1_pr_sl_type = u1_slice_type;
|
||||
ps_dec->i4_pic_type = B_SLICE;
|
||||
}
|
||||
else
|
||||
return ERROR_INV_SLC_TYPE_T;
|
||||
|
||||
ps_dec->ps_parse_cur_slice->end_of_slice = 1;
|
||||
if(ps_dec->u1_slice_header_done)
|
||||
{
|
||||
/*set to zero to indicate a valid slice has been decoded*/
|
||||
ps_dec->u4_first_slice_in_pic = 0;
|
||||
ps_dec->u1_first_slice_in_stream = 0;
|
||||
}
|
||||
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
|
||||
ps_dec->u2_cur_slice_num++;
|
||||
/* storing last Mb X and MbY of the slice */
|
||||
ps_dec->i2_prev_slice_mbx = ps_dec->u2_mbx;
|
||||
ps_dec->i2_prev_slice_mby = ps_dec->u2_mby;
|
||||
|
||||
/* End of Picture detection */
|
||||
|
||||
if(ps_dec->u2_total_mbs_coded >= (ps_seq->u2_max_mb_addr + 1))
|
||||
|
|
@ -1882,6 +1930,6 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
|
||||
PRINT_BIN_BIT_RATIO(ps_dec)
|
||||
|
||||
return OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,15 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
|
|||
UWORD8 u1_nal_ref_idc,
|
||||
dec_struct_t * ps_dec );
|
||||
|
||||
WORD32 ih264d_end_of_pic(dec_struct_t *ps_dec,
|
||||
UWORD8 u1_is_idr_slice,
|
||||
UWORD16 u2_frame_num);
|
||||
WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec,
|
||||
WORD32 i4_poc,
|
||||
pocstruct_t *ps_temp_poc,
|
||||
UWORD16 u2_frame_num,
|
||||
dec_pic_params_t *ps_pps);
|
||||
|
||||
WORD32 ih264d_ref_idx_reordering(dec_struct_t * ps_dec, UWORD8 u1_isB);
|
||||
WORD32 ih264d_read_mmco_commands(dec_struct_t * ps_dec);
|
||||
void ih264d_form_pred_weight_matrix(dec_struct_t *ps_dec);
|
||||
|
|
|
|||
|
|
@ -728,7 +728,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
UWORD16 u2_use_left_mb_pack;
|
||||
UWORD8 *pu1_luma_pred_buffer;
|
||||
/* CHANGED CODE */
|
||||
UWORD8 *pu1_luma_rei1_buffer;
|
||||
UWORD8 *pu1_luma_rec_buffer;
|
||||
UWORD8 *puc_top;
|
||||
|
||||
mb_neigbour_params_t *ps_left_mb;
|
||||
|
|
@ -751,7 +751,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
UWORD8 *pu1_mb_cb_rei1_buffer, *pu1_mb_cr_rei1_buffer;
|
||||
UWORD32 u4_recwidth_cr;
|
||||
/* CHANGED CODE */
|
||||
tfr_ctxt_t *ps_frame_buf = &ps_dec->s_tran_addrecon;
|
||||
tfr_ctxt_t *ps_frame_buf = ps_dec->ps_frame_buf_ip_recon;
|
||||
UWORD32 u4_luma_dc_only_csbp = 0;
|
||||
UWORD32 u4_luma_dc_only_cbp = 0;
|
||||
|
||||
|
|
@ -822,7 +822,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
/*********************Common pointer calculations *************************/
|
||||
/* CHANGED CODE */
|
||||
pu1_luma_pred_buffer = ps_dec->pu1_y;
|
||||
pu1_luma_rei1_buffer = ps_frame_buf->pu1_dest_y + (u4_num_pmbair << 4);
|
||||
pu1_luma_rec_buffer = ps_frame_buf->pu1_dest_y + (u4_num_pmbair << 4);
|
||||
pu1_mb_cb_rei1_buffer = ps_frame_buf->pu1_dest_u
|
||||
+ (u4_num_pmbair << 3) * YUV420SP_FACTOR;
|
||||
pu1_mb_cr_rei1_buffer = ps_frame_buf->pu1_dest_v + (u4_num_pmbair << 3);
|
||||
|
|
@ -835,7 +835,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
{
|
||||
if(u1_topmb == 0)
|
||||
{
|
||||
pu1_luma_rei1_buffer += (
|
||||
pu1_luma_rec_buffer += (
|
||||
u1_mb_field_decoding_flag ?
|
||||
(ui_rec_width >> 1) :
|
||||
(ui_rec_width << 4));
|
||||
|
|
@ -859,13 +859,13 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
}
|
||||
else
|
||||
{
|
||||
puc_top = pu1_luma_rei1_buffer - ui_rec_width;
|
||||
puc_top = pu1_luma_rec_buffer - ui_rec_width;
|
||||
pu1_top_u = pu1_mb_cb_rei1_buffer - u4_recwidth_cr;
|
||||
}
|
||||
/* CHANGED CODE */
|
||||
|
||||
/************* Left pointer *****************/
|
||||
pu1_yleft = pu1_luma_rei1_buffer - 1;
|
||||
pu1_yleft = pu1_luma_rec_buffer - 1;
|
||||
pu1_uleft = pu1_mb_cb_rei1_buffer - 1 * YUV420SP_FACTOR;
|
||||
|
||||
/**************Top Left pointer calculation**********/
|
||||
|
|
@ -924,9 +924,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
(u1_intrapred_mode ^ 2);
|
||||
|
||||
if((u1_err_code & u1_packed_modes) ^ u1_err_code)
|
||||
{
|
||||
return ERROR_INTRAPRED;
|
||||
}
|
||||
ps_dec->i4_error_code = ERROR_INTRAPRED;
|
||||
}
|
||||
{
|
||||
UWORD8 au1_ngbr_pels[33];
|
||||
|
|
@ -957,7 +955,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
}
|
||||
PROFILE_DISABLE_INTRA_PRED()
|
||||
ps_dec->apf_intra_pred_luma_16x16[u1_intrapred_mode](
|
||||
au1_ngbr_pels, pu1_luma_rei1_buffer, 1, ui_rec_width,
|
||||
au1_ngbr_pels, pu1_luma_rec_buffer, 1, ui_rec_width,
|
||||
((uc_useTopMB << 2) | u2_use_left_mb));
|
||||
}
|
||||
{
|
||||
|
|
@ -966,7 +964,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
for(i = 0; i < 16; i++)
|
||||
{
|
||||
WORD16 *pi2_level = pi2_y_coeff + (i << 4);
|
||||
UWORD8 *pu1_pred_sblk = pu1_luma_rei1_buffer
|
||||
UWORD8 *pu1_pred_sblk = pu1_luma_rec_buffer
|
||||
+ ((i & 0x3) * BLK_SIZE)
|
||||
+ (i >> 2) * (ui_rec_width << 2);
|
||||
PROFILE_DISABLE_IQ_IT_RECON()
|
||||
|
|
@ -1202,20 +1200,20 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
{
|
||||
|
||||
if(u1_sub_blk_y)
|
||||
pu1_top = pu1_luma_rei1_buffer - ui_rec_width;
|
||||
pu1_top = pu1_luma_rec_buffer - ui_rec_width;
|
||||
else
|
||||
pu1_top = puc_top + (u1_sub_blk_x << 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
pu1_top = pu1_luma_rei1_buffer - ui_rec_width;
|
||||
pu1_top = pu1_luma_rec_buffer - ui_rec_width;
|
||||
}
|
||||
/***************** Top Right *********************/
|
||||
pu1_top_right = pu1_top + 4;
|
||||
/***************** Top Left *********************/
|
||||
pu1_top_left = pu1_top - 1;
|
||||
/***************** Left *********************/
|
||||
pu1_left = pu1_luma_rei1_buffer - 1;
|
||||
pu1_left = pu1_luma_rec_buffer - 1;
|
||||
/* CHANGED CODE */
|
||||
|
||||
/*---------------------------------------------------------------*/
|
||||
|
|
@ -1289,7 +1287,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
}
|
||||
PROFILE_DISABLE_INTRA_PRED()
|
||||
ps_dec->apf_intra_pred_luma_4x4[i1_intra_pred](
|
||||
au1_ngbr_pels, pu1_luma_rei1_buffer, 1,
|
||||
au1_ngbr_pels, pu1_luma_rec_buffer, 1,
|
||||
ui_rec_width,
|
||||
((u1_is_top_sub_block << 2) | u1_is_left_sub_block));
|
||||
|
||||
|
|
@ -1303,8 +1301,8 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
{
|
||||
ps_dec->pf_iquant_itrans_recon_luma_4x4_dc(
|
||||
pi2_y_coeff1,
|
||||
pu1_luma_rei1_buffer,
|
||||
pu1_luma_rei1_buffer,
|
||||
pu1_luma_rec_buffer,
|
||||
pu1_luma_rec_buffer,
|
||||
ui_rec_width,
|
||||
ui_rec_width,
|
||||
gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6],
|
||||
|
|
@ -1316,8 +1314,8 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
{
|
||||
ps_dec->pf_iquant_itrans_recon_luma_4x4(
|
||||
pi2_y_coeff1,
|
||||
pu1_luma_rei1_buffer,
|
||||
pu1_luma_rei1_buffer,
|
||||
pu1_luma_rec_buffer,
|
||||
pu1_luma_rec_buffer,
|
||||
ui_rec_width,
|
||||
ui_rec_width,
|
||||
gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6],
|
||||
|
|
@ -1333,7 +1331,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
/* Update sub block number */
|
||||
/*---------------------------------------------------------------*/
|
||||
pi2_y_coeff1 += 16;
|
||||
pu1_luma_rei1_buffer +=
|
||||
pu1_luma_rec_buffer +=
|
||||
(u1_sub_blk_x == 3) ? (ui_rec_width << 2) - 12 : 4;
|
||||
pu1_luma_pred_buffer +=
|
||||
(u1_sub_blk_x == 3) ? (ui_pred_width << 2) - 12 : 4;
|
||||
|
|
@ -1591,7 +1589,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
{
|
||||
u1_is_top_sub_block = 1;
|
||||
// sushant
|
||||
pu1_top = /*pu1_luma_pred_buffer*/pu1_luma_rei1_buffer - ui_rec_width;
|
||||
pu1_top = /*pu1_luma_pred_buffer*/pu1_luma_rec_buffer - ui_rec_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1602,7 +1600,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
if((u1_sub_blk_x) | (u4_num_pmbair != 0))
|
||||
{
|
||||
// sushant
|
||||
pu1_left = /*pu1_luma_pred_buffer*/pu1_luma_rei1_buffer - 1;
|
||||
pu1_left = /*pu1_luma_pred_buffer*/pu1_luma_rec_buffer - 1;
|
||||
ui2_left_pred_buf_width = ui_rec_width;
|
||||
}
|
||||
else
|
||||
|
|
@ -1651,9 +1649,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
UWORD8 u1_err_code = pu1_intra_err_codes[i1_intra_pred];
|
||||
|
||||
if((u1_err_code & u1_packed_modes) ^ u1_err_code)
|
||||
{
|
||||
return ERROR_INTRAPRED;
|
||||
}
|
||||
ps_dec->i4_error_code = ERROR_INTRAPRED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1675,7 +1671,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
ngbr_avail);
|
||||
|
||||
ps_dec->apf_intra_pred_luma_8x8[i1_intra_pred](
|
||||
au1_ngbr_pels, pu1_luma_rei1_buffer, 1,
|
||||
au1_ngbr_pels, pu1_luma_rec_buffer, 1,
|
||||
ui_rec_width,
|
||||
((u1_is_top_sub_block << 2) | u1_is_left_sub_block));
|
||||
}
|
||||
|
|
@ -1695,8 +1691,8 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
{
|
||||
ps_dec->pf_iquant_itrans_recon_luma_8x8_dc(
|
||||
pi2_y_coeff1,
|
||||
pu1_luma_rei1_buffer,
|
||||
pu1_luma_rei1_buffer,
|
||||
pu1_luma_rec_buffer,
|
||||
pu1_luma_rec_buffer,
|
||||
ui_rec_width,
|
||||
ui_rec_width,
|
||||
gau1_ih264d_dequant8x8_cavlc[ps_cur_mb_info->u1_qp_rem6],
|
||||
|
|
@ -1708,8 +1704,8 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
{
|
||||
ps_dec->pf_iquant_itrans_recon_luma_8x8(
|
||||
pi2_y_coeff1,
|
||||
pu1_luma_rei1_buffer,
|
||||
pu1_luma_rei1_buffer,
|
||||
pu1_luma_rec_buffer,
|
||||
pu1_luma_rec_buffer,
|
||||
ui_rec_width,
|
||||
ui_rec_width,
|
||||
gau1_ih264d_dequant8x8_cavlc[ps_cur_mb_info->u1_qp_rem6],
|
||||
|
|
@ -1726,7 +1722,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
/*---------------------------------------------------------------*/
|
||||
pi2_y_coeff1 += 64;
|
||||
|
||||
pu1_luma_rei1_buffer +=
|
||||
pu1_luma_rec_buffer +=
|
||||
(u1_sub_blk_x == 1) ?
|
||||
(ui_rec_width << 3) - (8 * 1) : 8;
|
||||
|
||||
|
|
@ -1765,7 +1761,7 @@ WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec,
|
|||
u1_intra_chrom_pred_mode :
|
||||
(u1_intra_chrom_pred_mode ^ 2);
|
||||
if((u1_err_code & u1_packed_modes) ^ u1_err_code)
|
||||
return ERROR_INTRAPRED;
|
||||
ps_dec->i4_error_code = ERROR_INTRAPRED;
|
||||
}
|
||||
|
||||
/* CHANGED CODE */
|
||||
|
|
|
|||
|
|
@ -169,8 +169,6 @@ WORD32 ih264d_mv_pred_ref_tfr_nby2_pmb(dec_struct_t * ps_dec,
|
|||
/**************************************************/
|
||||
/* Loop on Partitions */
|
||||
/**************************************************/
|
||||
ps_dec->u4_dma_buf_idx = 0;
|
||||
|
||||
for(j = 0; j < u1_num_part; j++, ps_part++)
|
||||
{
|
||||
|
||||
|
|
@ -331,9 +329,7 @@ WORD32 ih264d_mv_pred_ref_tfr_nby2_pmb(dec_struct_t * ps_dec,
|
|||
return OK;
|
||||
}
|
||||
|
||||
#if THREAD_PARSE
|
||||
|
||||
#else
|
||||
WORD32 ih264d_decode_recon_tfr_nmb(dec_struct_t * ps_dec,
|
||||
UWORD8 u1_mb_idx,
|
||||
UWORD8 u1_num_mbs,
|
||||
|
|
@ -437,41 +433,56 @@ WORD32 ih264d_decode_recon_tfr_nmb(dec_struct_t * ps_dec,
|
|||
if((u1_ipcm_th + 25) != ps_cur_mb_info->u1_mb_type)
|
||||
{
|
||||
ps_cur_mb_info->u1_mb_type -= (u1_skip_th + 1);
|
||||
ret = ih264d_process_intra_mb(ps_dec, ps_cur_mb_info, j);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
ih264d_process_intra_mb(ps_dec, ps_cur_mb_info, j);
|
||||
}
|
||||
}
|
||||
|
||||
if(ps_dec->u4_mb_level_deblk == 1)
|
||||
{
|
||||
ih264d_deblock_mb_level(ps_dec, ps_cur_mb_info, j);
|
||||
|
||||
if(ps_dec->u4_use_intrapred_line_copy)
|
||||
{
|
||||
ih264d_copy_intra_pred_line(ps_dec, ps_cur_mb_info, j);
|
||||
}
|
||||
|
||||
if(u1_mbaff)
|
||||
{
|
||||
if(u4_update_mbaff)
|
||||
{
|
||||
UWORD32 u4_mb_num = ps_cur_mb_info->u2_mbx
|
||||
+ ps_dec->u2_frm_wd_in_mbs
|
||||
* (ps_cur_mb_info->u2_mby >> 1);
|
||||
UPDATE_MB_MAP_MBNUM_BYTE(ps_dec->pu1_recon_mb_map, u4_mb_num);
|
||||
u4_update_mbaff = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
u4_update_mbaff = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UWORD32 u4_mb_num = ps_cur_mb_info->u2_mbx
|
||||
+ ps_dec->u2_frm_wd_in_mbs * ps_cur_mb_info->u2_mby;
|
||||
UPDATE_MB_MAP_MBNUM_BYTE(ps_dec->pu1_recon_mb_map, u4_mb_num);
|
||||
}
|
||||
}
|
||||
|
||||
/*N MB deblocking*/
|
||||
if(ps_dec->u4_nmb_deblk == 1)
|
||||
{
|
||||
|
||||
UWORD32 u4_cur_mb, u4_right_mb;
|
||||
UWORD32 u4_mb_x, u4_mb_y;
|
||||
UWORD32 u4_wd_y, u4_wd_uv;
|
||||
tfr_ctxt_t *ps_tfr_cxt = &(ps_dec->s_tran_addrecon);
|
||||
UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag;
|
||||
const WORD32 i4_cb_qp_idx_ofst =
|
||||
ps_dec->ps_cur_pps->i1_chroma_qp_index_offset;
|
||||
const WORD32 i4_cr_qp_idx_ofst =
|
||||
ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset;
|
||||
|
||||
u4_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag;
|
||||
u4_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag;
|
||||
|
||||
|
||||
ps_cur_mb_info = ps_dec->ps_nmb_info + u1_mb_idx;
|
||||
|
||||
ps_dec->u4_deblk_mb_x = ps_cur_mb_info->u2_mbx;
|
||||
ps_dec->u4_deblk_mb_y = ps_cur_mb_info->u2_mby;
|
||||
|
||||
for(j = u1_mb_idx; j < i; j++)
|
||||
{
|
||||
|
||||
ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt,
|
||||
i4_cb_qp_idx_ofst, i4_cr_qp_idx_ofst,
|
||||
u4_wd_y, u4_wd_uv);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(u1_tfr_n_mb)
|
||||
{
|
||||
|
|
@ -496,18 +507,6 @@ WORD32 ih264d_decode_recon_tfr_nmb(dec_struct_t * ps_dec,
|
|||
u1_end_of_row_next);
|
||||
ps_dec->u4_num_mbs_prev_nmb = u1_num_mbs;
|
||||
|
||||
if(u1_end_of_row)
|
||||
{
|
||||
/* Reset the N-Mb Recon Buf Index to default Values */
|
||||
ps_dec->u2_mb_group_cols_y1 = ps_dec->u2_mb_group_cols_y;
|
||||
ps_dec->u2_mb_group_cols_cr1 = ps_dec->u2_mb_group_cols_cr;
|
||||
}
|
||||
/* If next N-Mb Group is the EndOfRow, set the N-Mb Recon Buf Index */
|
||||
else if(u1_end_of_row_next)
|
||||
{
|
||||
ps_dec->u2_mb_group_cols_y1 = (u1_num_mbs_next << 4) + 8;
|
||||
ps_dec->u2_mb_group_cols_cr1 = (u1_num_mbs_next << 3) + 8;
|
||||
}
|
||||
ps_dec->u4_pred_info_idx = 0;
|
||||
ps_dec->u4_dma_buf_idx = 0;
|
||||
|
||||
|
|
@ -515,7 +514,7 @@ WORD32 ih264d_decode_recon_tfr_nmb(dec_struct_t * ps_dec,
|
|||
}
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
**************************************************************************
|
||||
* \if Function name : ih264d_process_inter_mb \endif
|
||||
|
|
@ -543,7 +542,7 @@ WORD32 ih264d_process_inter_mb(dec_struct_t * ps_dec,
|
|||
UWORD32 uc_botMb;
|
||||
UWORD32 u4_num_pmbair;
|
||||
/* CHANGED CODE */
|
||||
tfr_ctxt_t *ps_frame_buf = &ps_dec->s_tran_addrecon;
|
||||
tfr_ctxt_t *ps_frame_buf = ps_dec->ps_frame_buf_ip_recon;
|
||||
UWORD32 u4_luma_dc_only_csbp = 0;
|
||||
UWORD32 u4_luma_dc_only_cbp = 0;
|
||||
/* CHANGED CODE */
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@
|
|||
#include "ih264_deblk_edge_filters.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** Number of Mb's whoose syntax will be read */
|
||||
/************************************************************/
|
||||
/* MB_GROUP should be a multiple of 2 */
|
||||
|
|
@ -59,10 +62,6 @@
|
|||
/* MV_SCRATCH_BUFS assumed to be pow(2) */
|
||||
#define MV_SCRATCH_BUFS 4
|
||||
|
||||
#define LEFT_MB_PIXELS 4
|
||||
#define LEFT_MB_PIXELS_Y_FRM_BOT 64 /* 4 * 16 */
|
||||
#define LEFT_MB_PIXELS_CR_FRM_BOT 32 /* 4 * 8 */
|
||||
|
||||
#define TOP_FIELD_ONLY 0x02
|
||||
#define BOT_FIELD_ONLY 0x01
|
||||
|
||||
|
|
@ -71,10 +70,6 @@
|
|||
struct _DecStruct;
|
||||
struct _DecMbInfo;
|
||||
|
||||
|
||||
#define NUM_INT_G_TABLE ((UWORD32) (sigcoeff_ctxtinc_field8x8 + 1))
|
||||
#define NUM_EXT_G_TABLE ((UWORD32) (ITTIAM_LOGO_V_BUF_T + 1))
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MB_TYPE_SI_SLICE = 0,
|
||||
|
|
@ -128,44 +123,6 @@ typedef enum
|
|||
COEFF_ABS_LEVEL_CAT_5_OFFSET = 0
|
||||
} cabac_blk_cat_offset_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CABAC_IPBMB_LD_ADRS_T,
|
||||
CABAC_IPBMB_LD_SZ_T,
|
||||
CAVLC_IPBMB_LD_ADRS_T,
|
||||
CAVLC_IPBMB_LD_SZ_T,
|
||||
PARSE_IPBMB_RUN_ADRS_T,
|
||||
|
||||
MVP_MBAFF_LD_ADRS_T,
|
||||
MVP_MBAFF_LD_SZ_T,
|
||||
MVP_NON_MBAFF_LD_ADRS_T,
|
||||
MVP_NON_MBAFF_LD_SZ_T,
|
||||
MVPRED_RUN_ADRS_T,
|
||||
|
||||
B_REF_DMA_LD_ADRS_T,
|
||||
B_REF_DMA_LD_SZ_T,
|
||||
P_REF_DMA_LD_ADRS_T,
|
||||
P_REF_DMA_LD_SZ_T,
|
||||
REF_DMA_RUN_ADRS_T,
|
||||
|
||||
SP_DRCT_LD_ADRS_T,
|
||||
SP_DRCT_LD_SZ_T,
|
||||
TMP_DRCT_LD_ADRS_T,
|
||||
TMP_DRCT_LD_SZ_T,
|
||||
B_SKIP_RUN_ADRS_T,
|
||||
|
||||
DEC_DEBLK_RUN_ADRS_T,
|
||||
H264_DBLK_LD_ADRS_T,
|
||||
H264_DBLK_LD_SZ_T,
|
||||
H264_DEC_LD_ADRS_T,
|
||||
|
||||
/*
|
||||
* (H264_DEC_LD_SZ_T + 1) will be considered as the end of this table
|
||||
* new members to be added before this
|
||||
*/
|
||||
H264_DEC_LD_SZ_T
|
||||
} code_overlay_tab_t;
|
||||
|
||||
/** Structure for the MV bank */
|
||||
typedef struct _mv_pred_t
|
||||
{
|
||||
|
|
@ -280,13 +237,8 @@ typedef struct
|
|||
}col_mv_buf_t;
|
||||
|
||||
|
||||
/* Note the i4_size of this structure is hardcoded in arm_default_weighted_Pred.s as 0x3C.
|
||||
* ADD r0,r0,#0x3C and so on..
|
||||
* If there is a change in i4_size update above file accordingly.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
UWORD8 u1_mc_addr_ofst; /** Offset in bytes relative to pu1_dma_dest_addr */
|
||||
UWORD8 u1_dydx; /** 4*dy + dx for Y comp / 8*dy + dx for UV comp */
|
||||
UWORD8 u1_is_bi_direct; /** 1: is bi-direct 0: forward / backward only */
|
||||
UWORD8 u1_wght_pred_type; /** 0-default 1-singleWeighted 2-BiWeighted */
|
||||
|
|
@ -723,23 +675,12 @@ typedef struct
|
|||
typedef struct _dec_slice_struct
|
||||
{
|
||||
volatile UWORD32 u4_first_mb_in_slice;
|
||||
volatile UWORD32 u4_num_mbs_done_in_slice;
|
||||
volatile UWORD32 slice_type;
|
||||
volatile UWORD32 end_of_slice;
|
||||
volatile UWORD32 slice_header_done;
|
||||
volatile UWORD32 last_slice_in_frame;
|
||||
volatile UWORD16 u2_log2Y_crwd;
|
||||
volatile UWORD16 u2_error_flag;
|
||||
volatile void **ppv_map_ref_idx_to_poc;
|
||||
volatile void *pv_tu_coeff_data_start;
|
||||
} dec_slice_struct_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UWORD32 u4_flag;
|
||||
UWORD32 u4_start_y;
|
||||
UWORD32 u4_num_rows_y;
|
||||
} fmt_conv_part_t;
|
||||
|
||||
/**
|
||||
* Structure to hold coefficient info for a 4x4 transform
|
||||
*/
|
||||
|
|
@ -811,7 +752,7 @@ typedef struct _DecStruct
|
|||
UWORD16 u2_pic_wd; /** Width of the picture being decoded */
|
||||
UWORD16 u2_pic_ht; /** Height of the picture being decoded */
|
||||
|
||||
UWORD8 u1_first_nal_in_pic;
|
||||
UWORD8 u1_first_slice_in_stream;
|
||||
UWORD8 u1_mb_ngbr_availablity;
|
||||
UWORD8 u1_ref_idxl0_active_minus1;
|
||||
UWORD8 u1_qp;
|
||||
|
|
@ -885,6 +826,7 @@ typedef struct _DecStruct
|
|||
*
|
||||
*/
|
||||
void *pv_parse_tu_coeff_data;
|
||||
void *pv_prev_mb_parse_tu_coeff_data;
|
||||
|
||||
void *pv_proc_tu_coeff_data;
|
||||
|
||||
|
|
@ -966,6 +908,9 @@ typedef struct _DecStruct
|
|||
/* DMA SETUP */
|
||||
tfr_ctxt_t s_tran_addrecon_parse;
|
||||
tfr_ctxt_t s_tran_addrecon;
|
||||
tfr_ctxt_t s_tran_iprecon;
|
||||
tfr_ctxt_t *ps_frame_buf_ip_recon;
|
||||
WORD8 i1_recon_in_thread3_flag;
|
||||
|
||||
/* slice Header Simplification */
|
||||
UWORD8 u1_pr_sl_type;
|
||||
|
|
@ -1078,10 +1023,6 @@ typedef struct _DecStruct
|
|||
UWORD8 u1_y_topleft[2]; /** Left Y pointer, used for intra-pred */
|
||||
UWORD8 u1_u_topleft[2]; /** Left U pointer, used for intra-pred */
|
||||
UWORD8 u1_v_topleft[2]; /** Left V pointer, used for intra-pred */
|
||||
UWORD16 u2_mb_group_cols_y; /** Number of Y pixels in the N MB group */
|
||||
UWORD16 u2_mb_group_cols_cr; /** Number of U/V pixels in the N MB group */
|
||||
UWORD16 u2_mb_group_cols_y1; /** Number of Y pixels in the N MB group */
|
||||
UWORD16 u2_mb_group_cols_cr1; /** Number of U/V pixels in the N MB group */
|
||||
|
||||
mv_pred_t *ps_mv_cur; /** pointer to current motion vector bank */
|
||||
mv_pred_t *ps_mv_top; /** pointer to top motion vector bank */
|
||||
|
|
@ -1317,6 +1258,7 @@ typedef struct _DecStruct
|
|||
/* Output format sent by the application */
|
||||
UWORD8 u1_chroma_format;
|
||||
UWORD8 u1_pic_decode_done;
|
||||
UWORD8 u1_slice_header_done;
|
||||
UWORD32 u4_level_at_init;
|
||||
UWORD32 u4_width_at_init;
|
||||
UWORD32 u4_height_at_init;
|
||||
|
|
@ -1348,9 +1290,10 @@ typedef struct _DecStruct
|
|||
WORD32 i4_display_delay;
|
||||
UWORD32 u4_slice_start_code_found;
|
||||
|
||||
UWORD32 u4_mb_level_deblk;
|
||||
UWORD32 u4_nmb_deblk;
|
||||
UWORD32 u4_use_intrapred_line_copy;
|
||||
UWORD32 u4_num_mbs_prev_nmb;
|
||||
UWORD32 u4_num_mbs_cur_nmb;
|
||||
UWORD32 u4_app_deblk_disable_level;
|
||||
UWORD32 u4_app_disable_deblk_frm;
|
||||
WORD32 i4_app_skip_mode;
|
||||
|
|
@ -1366,18 +1309,17 @@ typedef struct _DecStruct
|
|||
WORD32 i4_dec_skip_mode;
|
||||
|
||||
UWORD32 u4_bs_deblk_thread_created;
|
||||
volatile UWORD32 u4_start_bs_deblk;
|
||||
volatile UWORD32 u4_start_recon_deblk;
|
||||
void *pv_bs_deblk_thread_handle;
|
||||
|
||||
UWORD32 u4_cur_bs_mb_num;
|
||||
UWORD32 u4_bs_cur_slice_num_mbs;
|
||||
UWORD32 u4_cur_slice_bs_done;
|
||||
UWORD32 u4_cur_deblk_mb_num;
|
||||
volatile UWORD16 u2_cur_slice_num_bs;
|
||||
|
||||
UWORD32 u4_deblk_mb_x;
|
||||
UWORD32 u4_deblk_mb_y;
|
||||
deblk_mb_t *ps_cur_deblk_thrd_mb;
|
||||
|
||||
|
||||
|
||||
iv_yuv_buf_t s_disp_frame_info;
|
||||
|
|
@ -1389,12 +1331,12 @@ typedef struct _DecStruct
|
|||
UWORD32 u4_output_present;
|
||||
|
||||
volatile UWORD16 cur_dec_mb_num;
|
||||
volatile UWORD16 cur_recon_mb_num;
|
||||
volatile UWORD16 u2_cur_mb_addr;
|
||||
WORD16 i2_dec_thread_mb_y;
|
||||
WORD16 i2_recon_thread_mb_y;
|
||||
|
||||
UWORD8 u1_separate_parse;
|
||||
// 0: slice parse not started, 1: slice decode can start, 2: slice in error
|
||||
volatile UWORD32 u4_start_frame_decode;
|
||||
UWORD32 u4_dec_thread_created;
|
||||
void *pv_dec_thread_handle;
|
||||
volatile UWORD8 *pu1_dec_mb_map;
|
||||
|
|
@ -1442,11 +1384,7 @@ typedef struct _DecStruct
|
|||
*/
|
||||
WORD32 i4_degrade_pic_cnt;
|
||||
|
||||
fmt_conv_part_t as_fmt_conv_part[2];
|
||||
UWORD32 u4_fmt_conv_in_process;
|
||||
UWORD32 u4_pic_buf_got;
|
||||
UWORD16 u2_mb_skip_error;
|
||||
volatile UWORD16 u2_skip_deblock;
|
||||
|
||||
/**
|
||||
* Col flag and mv pred buffer manager
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "ih264_macros.h"
|
||||
#include "ih264_platform_macros.h"
|
||||
#include "ih264d_defs.h"
|
||||
#include "ih264d_tables.h"
|
||||
|
||||
const UWORD8 gau1_ih264d_qp_scale_cr[] =
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ extern const UWORD8 gau1_ih264d_clip_table[][4];
|
|||
|
||||
/*Parsing Table declaration*/
|
||||
extern const UWORD8 gau1_ih264d_cbp_tab[6];
|
||||
extern const UWORD32 gau4_ih264d_packed_bs2[16];
|
||||
extern const UWORD32 gau4_ih264d_packed_bs2[32];
|
||||
extern const UWORD16 gau2_ih264d_4x4_v2h_reorder[16];
|
||||
extern const UWORD8 gau1_ih264d_subblk_offset[16];
|
||||
extern const UWORD8 gau1_ih264d_cbp_table[48][2];
|
||||
|
|
@ -132,7 +132,7 @@ extern const UWORD8 gau1_ih264d_total_coeff_fn_ptr_offset[16];
|
|||
extern const WORD16 gai2_ih264d_trailing_one_level[14][3];
|
||||
|
||||
/*Decode CABAC Table declaration*/
|
||||
extern const UWORD32 gau4_ih264d_cabac_table[];
|
||||
extern const UWORD32 gau4_ih264d_cabac_table[128][4];
|
||||
|
||||
/****************************************************************************/
|
||||
/* For error detection in intra pred4x4 modes */
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@
|
|||
#include "ih264d_thread_compute_bs.h"
|
||||
#include "ithread.h"
|
||||
#include "ih264d_deblocking.h"
|
||||
#include "ih264d_process_pslice.h"
|
||||
#include "ih264d_process_intra_mb.h"
|
||||
#include "ih264d_mb_utils.h"
|
||||
#include "ih264d_tables.h"
|
||||
#include "ih264d_format_conv.h"
|
||||
|
|
@ -56,6 +58,9 @@ void ih264d_fill_bs2_horz_vert(UWORD32 *pu4_bs, /* Base pointer of BS table */
|
|||
WORD32 u4_top_mb_csbp, /* csbp of top mb */
|
||||
WORD32 u4_cur_mb_csbp, /* csbp of current mb */
|
||||
const UWORD32 *pu4_packed_bs2, const UWORD16 *pu2_4x4_v2h_reorder);
|
||||
void ih264d_copy_intra_pred_line(dec_struct_t *ps_dec,
|
||||
dec_mb_info_t *ps_cur_mb_info,
|
||||
UWORD32 nmb_index);
|
||||
|
||||
#define BS_MB_GROUP 4
|
||||
#define DEBLK_MB_GROUP 1
|
||||
|
|
@ -107,6 +112,8 @@ void ih264d_compute_bs_non_mbaff_thread(dec_struct_t * ps_dec,
|
|||
const UWORD32 u2_mbx = ps_cur_mb_info->u2_mbx;
|
||||
const UWORD32 u2_mby = ps_cur_mb_info->u2_mby;
|
||||
const UWORD32 u1_pingpong = u2_mbx & 0x01;
|
||||
|
||||
PROFILE_DISABLE_BOUNDARY_STRENGTH()
|
||||
ps_deblk_top_mb = ps_dec->ps_deblk_top_mb + u2_mbx;
|
||||
|
||||
/* Pointer assignment for Current DeblkMB, Current Mv Pred */
|
||||
|
|
@ -307,18 +314,16 @@ void ih264d_compute_bs_non_mbaff_thread(dec_struct_t * ps_dec,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void ih264d_check_mb_map_deblk(dec_struct_t *ps_dec,
|
||||
UWORD32 deblk_mb_grp,
|
||||
tfr_ctxt_t *ps_tfr_cxt)
|
||||
UWORD32 deblk_mb_grp,
|
||||
tfr_ctxt_t *ps_tfr_cxt,
|
||||
UWORD32 u4_check_mb_map)
|
||||
{
|
||||
UWORD32 i = 0;
|
||||
UWORD32 u4_mb_num;
|
||||
UWORD32 u4_cur_mb, u4_right_mb;
|
||||
UWORD32 u4_cond;
|
||||
volatile UWORD8 *mb_map = ps_dec->pu1_recon_mb_map;
|
||||
UWORD32 u4_mb_x, u4_mb_y, u4_image_wd_mb;
|
||||
deblk_mb_t *ps_cur_mb = ps_dec->ps_cur_deblk_thrd_mb;
|
||||
deblk_mb_t *ps_top_mb;
|
||||
deblk_mb_t *ps_left_mb;
|
||||
const WORD32 i4_cb_qp_idx_ofst =
|
||||
ps_dec->ps_cur_pps->i1_chroma_qp_index_offset;
|
||||
const WORD32 i4_cr_qp_idx_ofst =
|
||||
|
|
@ -327,171 +332,100 @@ void ih264d_check_mb_map_deblk(dec_struct_t *ps_dec,
|
|||
UWORD32 u4_wd_y, u4_wd_uv;
|
||||
UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag;
|
||||
|
||||
u4_mb_num = ps_dec->u4_cur_deblk_mb_num;
|
||||
u4_mb_x = ps_dec->u4_deblk_mb_x;
|
||||
u4_mb_y = ps_dec->u4_deblk_mb_y;
|
||||
u4_image_wd_mb = ps_dec->u2_frm_wd_in_mbs;
|
||||
|
||||
u4_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag;
|
||||
u4_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag;
|
||||
ps_cur_mb = ps_dec->ps_cur_deblk_thrd_mb;
|
||||
|
||||
|
||||
for(i = 0; i < deblk_mb_grp; i++)
|
||||
{
|
||||
|
||||
//while(1)
|
||||
//{
|
||||
CHECK_MB_MAP_BYTE(u4_mb_num, mb_map, u4_cur_mb);
|
||||
|
||||
if(ps_dec->u4_cur_bs_mb_num <= u4_mb_num)
|
||||
u4_cur_mb = 0;
|
||||
|
||||
if(u4_mb_x < (u4_image_wd_mb - 1))
|
||||
WORD32 nop_cnt = 8*128;
|
||||
while(u4_check_mb_map == 1)
|
||||
{
|
||||
CHECK_MB_MAP_BYTE((u4_mb_num + 1), mb_map, u4_right_mb);
|
||||
}
|
||||
else
|
||||
u4_right_mb = 1;
|
||||
u4_mb_num = ps_dec->u4_cur_deblk_mb_num;
|
||||
/*we wait for the right mb because of intra pred data dependency*/
|
||||
u4_mb_num = MIN(u4_mb_num + 1, (ps_dec->u4_deblk_mb_y + 1) * ps_dec->u2_frm_wd_in_mbs - 1);
|
||||
CHECK_MB_MAP_BYTE(u4_mb_num, mb_map, u4_cond);
|
||||
|
||||
if((u4_cur_mb && u4_right_mb) == 0)
|
||||
if(u4_cond)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(nop_cnt > 0)
|
||||
{
|
||||
nop_cnt -= 128;
|
||||
NOP(128);
|
||||
}
|
||||
else
|
||||
{
|
||||
nop_cnt = 8*128;
|
||||
ithread_yield();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt,
|
||||
i4_cb_qp_idx_ofst, i4_cr_qp_idx_ofst,
|
||||
u4_wd_y, u4_wd_uv);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void ih264d_recon_deblk_slice(dec_struct_t *ps_dec, tfr_ctxt_t *ps_tfr_cxt)
|
||||
{
|
||||
dec_mb_info_t *p_cur_mb;
|
||||
UWORD32 u4_max_addr;
|
||||
WORD32 i;
|
||||
UWORD32 u1_mb_aff;
|
||||
UWORD16 u2_slice_num;
|
||||
UWORD32 u4_mb_num;
|
||||
UWORD16 u2_first_mb_in_slice;
|
||||
UWORD32 i2_pic_wdin_mbs;
|
||||
UWORD8 u1_num_mbsleft, u1_end_of_row;
|
||||
UWORD8 u1_mbaff;
|
||||
UWORD16 i16_mb_x, i16_mb_y;
|
||||
WORD32 j;
|
||||
dec_mb_info_t * ps_cur_mb_info;
|
||||
UWORD32 u1_slice_type, u1_B;
|
||||
WORD32 u1_skip_th;
|
||||
UWORD32 u1_ipcm_th;
|
||||
WORD32 ret;
|
||||
tfr_ctxt_t *ps_trns_addr;
|
||||
UWORD32 u4_frame_stride;
|
||||
UWORD32 x_offset, y_offset;
|
||||
UWORD32 u4_slice_end;
|
||||
pad_mgr_t *ps_pad_mgr ;
|
||||
|
||||
/*check for mb map of first mb in slice to ensure slice header is parsed*/
|
||||
while(1)
|
||||
{
|
||||
UWORD32 u4_mb_num = ps_dec->cur_recon_mb_num;
|
||||
UWORD32 u4_cond = 0;
|
||||
WORD32 nop_cnt = 8*128;
|
||||
|
||||
CHECK_MB_MAP_BYTE(u4_mb_num, ps_dec->pu1_recon_mb_map, u4_cond);
|
||||
if(u4_cond)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
u4_mb_num++;
|
||||
{
|
||||
UWORD32 u4_deb_mode, u4_mbs_next;
|
||||
u4_deb_mode = ps_cur_mb->u1_deblocking_mode;
|
||||
if(!(u4_deb_mode & MB_DISABLE_FILTERING))
|
||||
if(nop_cnt > 0)
|
||||
{
|
||||
|
||||
if(u4_mb_x)
|
||||
{
|
||||
ps_left_mb = ps_cur_mb - 1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_left_mb = NULL;
|
||||
|
||||
}
|
||||
if(u4_mb_y != 0)
|
||||
{
|
||||
ps_top_mb = ps_cur_mb - (u4_image_wd_mb);
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_top_mb = NULL;
|
||||
}
|
||||
|
||||
if(u4_deb_mode & MB_DISABLE_LEFT_EDGE)
|
||||
ps_left_mb = NULL;
|
||||
if(u4_deb_mode & MB_DISABLE_TOP_EDGE)
|
||||
ps_top_mb = NULL;
|
||||
|
||||
ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt,
|
||||
i4_cb_qp_idx_ofst, i4_cr_qp_idx_ofst,
|
||||
ps_cur_mb, u4_wd_y, u4_wd_uv,
|
||||
ps_top_mb, ps_left_mb);
|
||||
|
||||
}
|
||||
|
||||
ps_cur_mb++;
|
||||
u4_mb_x++;
|
||||
u4_mbs_next = u4_image_wd_mb - u4_mb_x;
|
||||
|
||||
ps_tfr_cxt->pu1_mb_y += 16;
|
||||
ps_tfr_cxt->pu1_mb_u += 8 * YUV420SP_FACTOR;
|
||||
ps_tfr_cxt->pu1_mb_v += 8;
|
||||
|
||||
if(!u4_mbs_next)
|
||||
{
|
||||
ps_tfr_cxt->pu1_mb_y += ps_tfr_cxt->u4_y_inc;
|
||||
ps_tfr_cxt->pu1_mb_u += ps_tfr_cxt->u4_uv_inc;
|
||||
ps_tfr_cxt->pu1_mb_v += ps_tfr_cxt->u4_uv_inc;
|
||||
u4_mb_y++;
|
||||
u4_mb_x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ps_dec->u4_cur_deblk_mb_num = u4_mb_num;
|
||||
ps_dec->u4_deblk_mb_x = u4_mb_x;
|
||||
ps_dec->u4_deblk_mb_y = u4_mb_y;
|
||||
ps_dec->ps_cur_deblk_thrd_mb = ps_cur_mb;
|
||||
|
||||
}
|
||||
|
||||
void ih264d_check_mb_map_deblk_wait(dec_struct_t *ps_dec,
|
||||
UWORD32 deblk_mb_grp,
|
||||
tfr_ctxt_t *ps_tfr_cxt)
|
||||
{
|
||||
UWORD32 i = 0;
|
||||
UWORD32 u4_mb_num;
|
||||
UWORD32 u4_cur_mb, u4_right_mb;
|
||||
volatile UWORD8 *mb_map = ps_dec->pu1_recon_mb_map;
|
||||
UWORD32 u4_mb_x, u4_mb_y, u4_image_wd_mb;
|
||||
deblk_mb_t *ps_cur_mb = ps_dec->ps_cur_deblk_thrd_mb;
|
||||
deblk_mb_t *ps_top_mb;
|
||||
deblk_mb_t *ps_left_mb;
|
||||
const WORD32 i4_cb_qp_idx_ofst =
|
||||
ps_dec->ps_cur_pps->i1_chroma_qp_index_offset;
|
||||
const WORD32 i4_cr_qp_idx_ofst =
|
||||
ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset;
|
||||
|
||||
UWORD32 u4_wd_y, u4_wd_uv;
|
||||
UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag;
|
||||
|
||||
u4_mb_num = ps_dec->u4_cur_deblk_mb_num;
|
||||
u4_mb_x = ps_dec->u4_deblk_mb_x;
|
||||
u4_mb_y = ps_dec->u4_deblk_mb_y;
|
||||
u4_image_wd_mb = ps_dec->u2_frm_wd_in_mbs;
|
||||
u4_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag;
|
||||
u4_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag;
|
||||
ps_cur_mb = ps_dec->ps_cur_deblk_thrd_mb;
|
||||
|
||||
for(i = 0; i < deblk_mb_grp; i++)
|
||||
{
|
||||
|
||||
while(1)
|
||||
{
|
||||
CHECK_MB_MAP_BYTE(u4_mb_num, mb_map, u4_cur_mb);
|
||||
|
||||
if(ps_dec->u4_cur_bs_mb_num <= u4_mb_num)
|
||||
u4_cur_mb = 0;
|
||||
|
||||
if(u4_mb_x < (u4_image_wd_mb - 1))
|
||||
{
|
||||
CHECK_MB_MAP_BYTE((u4_mb_num + 1), mb_map, u4_right_mb);
|
||||
nop_cnt -= 128;
|
||||
NOP(128);
|
||||
}
|
||||
else
|
||||
u4_right_mb = 1;
|
||||
|
||||
if(ps_dec->u2_mb_skip_error)
|
||||
{
|
||||
ps_dec->u2_skip_deblock = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(ps_dec->u2_skip_deblock == 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if((u4_cur_mb && u4_right_mb) == 0)
|
||||
{
|
||||
|
||||
if(ps_dec->u4_output_present
|
||||
&& ps_dec->u4_fmt_conv_cur_row
|
||||
< ps_dec->s_disp_frame_info.u4_y_ht)
|
||||
if(ps_dec->u4_output_present &&
|
||||
(ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht))
|
||||
{
|
||||
ps_dec->u4_fmt_conv_num_rows =
|
||||
MIN(ps_dec->u4_fmt_conv_num_rows,
|
||||
MIN(FMT_CONV_NUM_ROWS,
|
||||
(ps_dec->s_disp_frame_info.u4_y_ht
|
||||
- ps_dec->u4_fmt_conv_cur_row));
|
||||
ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op),
|
||||
|
|
@ -500,148 +434,217 @@ void ih264d_check_mb_map_deblk_wait(dec_struct_t *ps_dec,
|
|||
ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
|
||||
}
|
||||
else
|
||||
NOP(32);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
{
|
||||
nop_cnt = 8*128;
|
||||
ithread_yield();
|
||||
}
|
||||
}
|
||||
DEBUG_THREADS_PRINTF("waiting for mb mapcur_dec_mb_num = %d,ps_dec->u2_cur_mb_addr = %d\n",u2_cur_dec_mb_num,
|
||||
ps_dec->u2_cur_mb_addr);
|
||||
|
||||
}
|
||||
|
||||
u4_mb_num++;
|
||||
{
|
||||
UWORD32 u4_deb_mode, u4_mbs_next;
|
||||
u4_deb_mode = ps_cur_mb->u1_deblocking_mode;
|
||||
if(!(u4_deb_mode & MB_DISABLE_FILTERING))
|
||||
{
|
||||
|
||||
if(u4_mb_x)
|
||||
{
|
||||
ps_left_mb = ps_cur_mb - 1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_left_mb = NULL;
|
||||
|
||||
}
|
||||
if(u4_mb_y != 0)
|
||||
{
|
||||
ps_top_mb = ps_cur_mb - (u4_image_wd_mb);
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_top_mb = NULL;
|
||||
}
|
||||
|
||||
if(u4_deb_mode & MB_DISABLE_LEFT_EDGE)
|
||||
ps_left_mb = NULL;
|
||||
if(u4_deb_mode & MB_DISABLE_TOP_EDGE)
|
||||
ps_top_mb = NULL;
|
||||
|
||||
ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt,
|
||||
i4_cb_qp_idx_ofst, i4_cr_qp_idx_ofst,
|
||||
ps_cur_mb, u4_wd_y, u4_wd_uv,
|
||||
ps_top_mb, ps_left_mb);
|
||||
}
|
||||
|
||||
ps_cur_mb++;
|
||||
u4_mb_x++;
|
||||
u4_mbs_next = u4_image_wd_mb - u4_mb_x;
|
||||
|
||||
ps_tfr_cxt->pu1_mb_y += 16;
|
||||
ps_tfr_cxt->pu1_mb_u += 8 * YUV420SP_FACTOR;
|
||||
ps_tfr_cxt->pu1_mb_v += 8;
|
||||
|
||||
if(!u4_mbs_next)
|
||||
{
|
||||
ps_tfr_cxt->pu1_mb_y += ps_tfr_cxt->u4_y_inc;
|
||||
ps_tfr_cxt->pu1_mb_u += ps_tfr_cxt->u4_uv_inc;
|
||||
ps_tfr_cxt->pu1_mb_v += ps_tfr_cxt->u4_uv_inc;
|
||||
u4_mb_y++;
|
||||
u4_mb_x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ps_dec->u4_cur_deblk_mb_num = u4_mb_num;
|
||||
ps_dec->u4_deblk_mb_x = u4_mb_x;
|
||||
ps_dec->u4_deblk_mb_y = u4_mb_y;
|
||||
ps_dec->ps_cur_deblk_thrd_mb = ps_cur_mb;
|
||||
u4_max_addr = ps_dec->ps_cur_sps->u2_max_mb_addr;
|
||||
u1_mb_aff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
|
||||
u2_first_mb_in_slice = ps_dec->ps_computebs_cur_slice->u4_first_mb_in_slice;
|
||||
i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs;
|
||||
u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
|
||||
ps_pad_mgr = &ps_dec->s_pad_mgr;
|
||||
|
||||
}
|
||||
void ih264d_computebs_deblk_slice(dec_struct_t *ps_dec, tfr_ctxt_t *ps_tfr_cxt)
|
||||
{
|
||||
dec_mb_info_t *p_cur_mb;
|
||||
UWORD32 u4_max_addr = ps_dec->ps_cur_sps->u2_max_mb_addr;
|
||||
UWORD32 i;
|
||||
UWORD32 u1_mb_aff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
|
||||
UWORD16 u2_slice_num;
|
||||
UWORD32 u4_mb_num;
|
||||
if(u2_first_mb_in_slice == 0)
|
||||
ih264d_init_deblk_tfr_ctxt(ps_dec, ps_pad_mgr, ps_tfr_cxt,
|
||||
ps_dec->u2_frm_wd_in_mbs, 0);
|
||||
|
||||
ps_dec->u4_cur_slice_bs_done = 0;
|
||||
|
||||
i16_mb_x = MOD(u2_first_mb_in_slice, i2_pic_wdin_mbs);
|
||||
i16_mb_y = DIV(u2_first_mb_in_slice, i2_pic_wdin_mbs);
|
||||
i16_mb_y <<= u1_mbaff;
|
||||
ps_dec->i2_recon_thread_mb_y = i16_mb_y;
|
||||
u4_frame_stride = ps_dec->u2_frm_wd_y
|
||||
<< ps_dec->ps_cur_slice->u1_field_pic_flag;
|
||||
|
||||
x_offset = i16_mb_x << 4;
|
||||
y_offset = (i16_mb_y * u4_frame_stride) << 4;
|
||||
ps_trns_addr = &ps_dec->s_tran_iprecon;
|
||||
|
||||
ps_trns_addr->pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1 + x_offset + y_offset;
|
||||
|
||||
u4_frame_stride = ps_dec->u2_frm_wd_uv
|
||||
<< ps_dec->ps_cur_slice->u1_field_pic_flag;
|
||||
x_offset >>= 1;
|
||||
y_offset = (i16_mb_y * u4_frame_stride) << 3;
|
||||
|
||||
x_offset *= YUV420SP_FACTOR;
|
||||
|
||||
ps_trns_addr->pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2 + x_offset + y_offset;
|
||||
ps_trns_addr->pu1_dest_v = ps_dec->s_cur_pic.pu1_buf3 + x_offset + y_offset;
|
||||
|
||||
ps_trns_addr->pu1_mb_y = ps_trns_addr->pu1_dest_y;
|
||||
ps_trns_addr->pu1_mb_u = ps_trns_addr->pu1_dest_u;
|
||||
ps_trns_addr->pu1_mb_v = ps_trns_addr->pu1_dest_v;
|
||||
|
||||
ps_dec->cur_recon_mb_num = u2_first_mb_in_slice << u1_mbaff;
|
||||
|
||||
u4_slice_end = 0;
|
||||
ps_dec->u4_bs_cur_slice_num_mbs = 0;
|
||||
ps_dec->u4_cur_bs_mb_num =
|
||||
(ps_dec->ps_computebs_cur_slice->u4_first_mb_in_slice)
|
||||
<< u1_mb_aff;
|
||||
|
||||
while(ps_dec->u4_cur_slice_bs_done != 1)
|
||||
if(ps_dec->i1_recon_in_thread3_flag)
|
||||
{
|
||||
UWORD32 bs_mb_grp = BS_MB_GROUP;
|
||||
ps_dec->pv_proc_tu_coeff_data =
|
||||
(void *) ps_dec->ps_computebs_cur_slice->pv_tu_coeff_data_start;
|
||||
}
|
||||
|
||||
u1_slice_type = ps_dec->ps_computebs_cur_slice->slice_type;
|
||||
|
||||
u1_B = (u1_slice_type == B_SLICE);
|
||||
|
||||
u1_skip_th = ((u1_slice_type != I_SLICE) ?
|
||||
(u1_B ? B_8x8 : PRED_8x8R0) : -1);
|
||||
|
||||
u1_ipcm_th = ((u1_slice_type != I_SLICE) ? (u1_B ? 23 : 5) : 0);
|
||||
|
||||
|
||||
|
||||
while(u4_slice_end != 1)
|
||||
{
|
||||
WORD32 recon_mb_grp,bs_mb_grp;
|
||||
WORD32 nop_cnt = 8*128;
|
||||
u1_num_mbsleft = ((i2_pic_wdin_mbs - i16_mb_x) << u1_mbaff);
|
||||
if(u1_num_mbsleft <= ps_dec->u1_recon_mb_grp)
|
||||
{
|
||||
recon_mb_grp = u1_num_mbsleft;
|
||||
u1_end_of_row = 1;
|
||||
i16_mb_x = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
recon_mb_grp = ps_dec->u1_recon_mb_grp;
|
||||
u1_end_of_row = 0;
|
||||
i16_mb_x += (recon_mb_grp >> u1_mbaff);
|
||||
}
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
||||
UWORD32 u4_cond = 0;
|
||||
UWORD32 u4_mb_num = ps_dec->cur_recon_mb_num + recon_mb_grp - 1;
|
||||
|
||||
u4_mb_num = ps_dec->u4_cur_bs_mb_num;
|
||||
/*
|
||||
* Wait for one extra mb of MC, because some chroma IQ-IT functions
|
||||
* sometimes loads the pixels of the right mb and stores with the loaded
|
||||
* values.
|
||||
*/
|
||||
u4_mb_num = MIN(u4_mb_num + 1, (ps_dec->i2_recon_thread_mb_y + 1) * i2_pic_wdin_mbs - 1);
|
||||
|
||||
/*introducing 1 MB delay*/
|
||||
if((u4_mb_num + BS_MB_GROUP) <= u4_max_addr)
|
||||
u4_mb_num = u4_mb_num + BS_MB_GROUP;
|
||||
else
|
||||
{
|
||||
bs_mb_grp = u4_max_addr - u4_mb_num + 1;
|
||||
u4_mb_num = u4_max_addr;
|
||||
|
||||
}
|
||||
|
||||
CHECK_MB_MAP_BYTE(u4_mb_num, ps_dec->pu1_dec_mb_map, u4_cond);
|
||||
CHECK_MB_MAP_BYTE(u4_mb_num, ps_dec->pu1_recon_mb_map, u4_cond);
|
||||
if(u4_cond)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if(ps_dec->u2_skip_deblock == 0)
|
||||
else
|
||||
{
|
||||
ih264d_check_mb_map_deblk(ps_dec, DEBLK_MB_GROUP, ps_tfr_cxt);
|
||||
if(nop_cnt > 0)
|
||||
{
|
||||
nop_cnt -= 128;
|
||||
NOP(128);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ps_dec->u4_output_present &&
|
||||
(ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht))
|
||||
{
|
||||
ps_dec->u4_fmt_conv_num_rows =
|
||||
MIN(FMT_CONV_NUM_ROWS,
|
||||
(ps_dec->s_disp_frame_info.u4_y_ht
|
||||
- ps_dec->u4_fmt_conv_cur_row));
|
||||
ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op),
|
||||
ps_dec->u4_fmt_conv_cur_row,
|
||||
ps_dec->u4_fmt_conv_num_rows);
|
||||
ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
|
||||
}
|
||||
else
|
||||
{
|
||||
nop_cnt = 8*128;
|
||||
ithread_yield();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GET_SLICE_NUM_MAP(ps_dec->pu2_slice_num_map, ps_dec->u4_cur_bs_mb_num,
|
||||
u2_slice_num);
|
||||
|
||||
if(u2_slice_num != ps_dec->u2_cur_slice_num_bs)
|
||||
for(j = 0; j < recon_mb_grp; j++)
|
||||
{
|
||||
ps_dec->u4_cur_slice_bs_done = 1;
|
||||
}
|
||||
|
||||
/* Compute BS for NMB group*/
|
||||
for(i = 0; i < bs_mb_grp; i++)
|
||||
{
|
||||
GET_SLICE_NUM_MAP(ps_dec->pu2_slice_num_map,
|
||||
ps_dec->u4_cur_bs_mb_num, u2_slice_num);
|
||||
GET_SLICE_NUM_MAP(ps_dec->pu2_slice_num_map, ps_dec->cur_recon_mb_num,
|
||||
u2_slice_num);
|
||||
|
||||
if(u2_slice_num != ps_dec->u2_cur_slice_num_bs)
|
||||
{
|
||||
ps_dec->u4_cur_slice_bs_done = 1;
|
||||
}
|
||||
|
||||
if(ps_dec->u4_cur_slice_bs_done == 1)
|
||||
u4_slice_end = 1;
|
||||
break;
|
||||
}
|
||||
if(ps_dec->i1_recon_in_thread3_flag)
|
||||
{
|
||||
ps_cur_mb_info = &ps_dec->ps_frm_mb_info[ps_dec->cur_recon_mb_num];
|
||||
|
||||
p_cur_mb = &ps_dec->ps_frm_mb_info[ps_dec->u4_cur_bs_mb_num
|
||||
& PD_MB_BUF_SIZE_MOD];
|
||||
if(ps_cur_mb_info->u1_mb_type <= u1_skip_th)
|
||||
{
|
||||
ih264d_process_inter_mb(ps_dec, ps_cur_mb_info, j);
|
||||
}
|
||||
else if(ps_cur_mb_info->u1_mb_type != MB_SKIP)
|
||||
{
|
||||
if((u1_ipcm_th + 25) != ps_cur_mb_info->u1_mb_type)
|
||||
{
|
||||
ps_cur_mb_info->u1_mb_type -= (u1_skip_th + 1);
|
||||
ih264d_process_intra_mb(ps_dec, ps_cur_mb_info, j);
|
||||
}
|
||||
}
|
||||
|
||||
ih264d_copy_intra_pred_line(ps_dec, ps_cur_mb_info, j);
|
||||
}
|
||||
ps_dec->cur_recon_mb_num++;
|
||||
}
|
||||
|
||||
if(j != recon_mb_grp)
|
||||
{
|
||||
u1_end_of_row = 0;
|
||||
}
|
||||
|
||||
{
|
||||
tfr_ctxt_t *ps_trns_addr = &ps_dec->s_tran_iprecon;
|
||||
UWORD16 u2_mb_y;
|
||||
|
||||
ps_trns_addr->pu1_dest_y += ps_trns_addr->u4_inc_y[u1_end_of_row];
|
||||
ps_trns_addr->pu1_dest_u += ps_trns_addr->u4_inc_uv[u1_end_of_row];
|
||||
ps_trns_addr->pu1_dest_v += ps_trns_addr->u4_inc_uv[u1_end_of_row];
|
||||
|
||||
if(u1_end_of_row)
|
||||
{
|
||||
ps_dec->i2_recon_thread_mb_y += (1 << u1_mbaff);
|
||||
u2_mb_y = ps_dec->i2_recon_thread_mb_y;
|
||||
y_offset = (u2_mb_y * u4_frame_stride) << 4;
|
||||
ps_trns_addr->pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1 + y_offset;
|
||||
|
||||
u4_frame_stride = ps_dec->u2_frm_wd_uv
|
||||
<< ps_dec->ps_cur_slice->u1_field_pic_flag;
|
||||
y_offset = (u2_mb_y * u4_frame_stride) << 3;
|
||||
ps_trns_addr->pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2 + y_offset;
|
||||
ps_trns_addr->pu1_dest_v = ps_dec->s_cur_pic.pu1_buf3 + y_offset;
|
||||
|
||||
ps_trns_addr->pu1_mb_y = ps_trns_addr->pu1_dest_y;
|
||||
ps_trns_addr->pu1_mb_u = ps_trns_addr->pu1_dest_u;
|
||||
ps_trns_addr->pu1_mb_v = ps_trns_addr->pu1_dest_v;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bs_mb_grp = j;
|
||||
/* Compute BS for NMB group*/
|
||||
for(i = 0; i < bs_mb_grp; i++)
|
||||
{
|
||||
p_cur_mb = &ps_dec->ps_frm_mb_info[ps_dec->u4_cur_bs_mb_num];
|
||||
|
||||
DEBUG_THREADS_PRINTF("ps_dec->u4_cur_bs_mb_num = %d\n",ps_dec->u4_cur_bs_mb_num);
|
||||
ih264d_compute_bs_non_mbaff_thread(ps_dec, p_cur_mb,
|
||||
|
|
@ -653,7 +656,7 @@ void ih264d_computebs_deblk_slice(dec_struct_t *ps_dec, tfr_ctxt_t *ps_tfr_cxt)
|
|||
|
||||
if(ps_dec->u4_cur_bs_mb_num > u4_max_addr)
|
||||
{
|
||||
ps_dec->u4_cur_slice_bs_done = 1;
|
||||
u4_slice_end = 1;
|
||||
}
|
||||
|
||||
/*deblock MB group*/
|
||||
|
|
@ -661,142 +664,74 @@ void ih264d_computebs_deblk_slice(dec_struct_t *ps_dec, tfr_ctxt_t *ps_tfr_cxt)
|
|||
UWORD32 u4_num_mbs;
|
||||
|
||||
if(ps_dec->u4_cur_bs_mb_num > ps_dec->u4_cur_deblk_mb_num)
|
||||
|
||||
u4_num_mbs = ps_dec->u4_cur_bs_mb_num
|
||||
- ps_dec->u4_cur_deblk_mb_num;
|
||||
{
|
||||
if(u1_end_of_row)
|
||||
{
|
||||
u4_num_mbs = ps_dec->u4_cur_bs_mb_num
|
||||
- ps_dec->u4_cur_deblk_mb_num;
|
||||
}
|
||||
else
|
||||
{
|
||||
u4_num_mbs = ps_dec->u4_cur_bs_mb_num
|
||||
- ps_dec->u4_cur_deblk_mb_num - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
u4_num_mbs = 0;
|
||||
|
||||
if(u4_num_mbs >= DEBLK_MB_GROUP)
|
||||
u4_num_mbs = DEBLK_MB_GROUP;
|
||||
if(ps_dec->u2_skip_deblock == 0)
|
||||
{
|
||||
ih264d_check_mb_map_deblk_wait(ps_dec, u4_num_mbs, ps_tfr_cxt);
|
||||
}
|
||||
ih264d_check_mb_map_deblk(ps_dec, u4_num_mbs, ps_tfr_cxt,0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ih264d_computebs_deblk_thread(dec_struct_t *ps_dec)
|
||||
void ih264d_recon_deblk_thread(dec_struct_t *ps_dec)
|
||||
{
|
||||
tfr_ctxt_t s_tfr_ctxt;
|
||||
tfr_ctxt_t *ps_tfr_cxt = &s_tfr_ctxt; // = &ps_dec->s_tran_addrecon;
|
||||
pad_mgr_t *ps_pad_mgr = &ps_dec->s_pad_mgr;
|
||||
|
||||
|
||||
UWORD32 yield_cnt = 0;
|
||||
|
||||
ithread_set_name("ih264d_computebs_deblk_thread");
|
||||
ithread_set_name("ih264d_recon_deblk_thread");
|
||||
|
||||
|
||||
// run the loop till all slices are decoded
|
||||
|
||||
// 0: un-identified state, 1 - bs needed, 2 - bs not needed
|
||||
while(1)
|
||||
{
|
||||
if(ps_dec->u4_start_bs_deblk == 0)
|
||||
|
||||
DEBUG_THREADS_PRINTF(" Entering compute bs slice\n");
|
||||
ih264d_recon_deblk_slice(ps_dec, ps_tfr_cxt);
|
||||
|
||||
DEBUG_THREADS_PRINTF(" Exit compute bs slice \n");
|
||||
|
||||
if(ps_dec->cur_recon_mb_num > ps_dec->ps_cur_sps->u2_max_mb_addr)
|
||||
{
|
||||
NOP(128);
|
||||
NOP(128);
|
||||
NOP(128);
|
||||
NOP(128);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
ps_dec->ps_computebs_cur_slice++;
|
||||
ps_dec->u2_cur_slice_num_bs++;
|
||||
}
|
||||
DEBUG_THREADS_PRINTF("CBS thread:Got next slice/end of frame signal \n ");
|
||||
|
||||
}
|
||||
|
||||
if(ps_dec->u4_start_bs_deblk == 1)
|
||||
if(ps_dec->u4_output_present &&
|
||||
(3 == ps_dec->u4_num_cores) &&
|
||||
(ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht))
|
||||
{
|
||||
ps_dec->u4_cur_deblk_mb_num = 0;
|
||||
ps_dec->u4_deblk_mb_x = 0;
|
||||
ps_dec->u4_deblk_mb_y = 0;
|
||||
ps_dec->u4_fmt_conv_num_rows =
|
||||
(ps_dec->s_disp_frame_info.u4_y_ht
|
||||
- ps_dec->u4_fmt_conv_cur_row);
|
||||
ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op),
|
||||
ps_dec->u4_fmt_conv_cur_row,
|
||||
ps_dec->u4_fmt_conv_num_rows);
|
||||
ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
|
||||
|
||||
ih264d_init_deblk_tfr_ctxt(ps_dec, ps_pad_mgr, ps_tfr_cxt,
|
||||
ps_dec->u2_frm_wd_in_mbs, 0);
|
||||
|
||||
ps_tfr_cxt->pu1_mb_y = ps_tfr_cxt->pu1_src_y + 4;
|
||||
ps_tfr_cxt->pu1_mb_u = ps_tfr_cxt->pu1_src_u + 4;
|
||||
ps_tfr_cxt->pu1_mb_v = ps_tfr_cxt->pu1_src_v + 4;
|
||||
|
||||
ps_dec->ps_cur_deblk_thrd_mb = ps_dec->ps_deblk_pic;
|
||||
|
||||
while(1)
|
||||
{
|
||||
/*Complete all writes before processing next slice*/
|
||||
DATA_SYNC();
|
||||
/*wait untill all the slice params have been populated*/
|
||||
while(ps_dec->ps_computebs_cur_slice->slice_header_done == 0)
|
||||
{
|
||||
NOP(32); DEBUG_THREADS_PRINTF(" waiting for slice header at compute bs\n");
|
||||
}
|
||||
|
||||
DEBUG_THREADS_PRINTF(" Entering compute bs slice\n");
|
||||
ih264d_computebs_deblk_slice(ps_dec, ps_tfr_cxt);
|
||||
|
||||
DEBUG_THREADS_PRINTF(" Exit compute bs slice \n");
|
||||
|
||||
/*Complete all writes before processing next slice*/
|
||||
DATA_SYNC();
|
||||
|
||||
while(1)
|
||||
{
|
||||
volatile void * parse_addr, *computebs_addr;
|
||||
volatile UWORD32 last_slice;
|
||||
|
||||
parse_addr = (volatile void *)ps_dec->ps_parse_cur_slice;
|
||||
computebs_addr =
|
||||
(volatile void *)ps_dec->ps_computebs_cur_slice;
|
||||
last_slice =
|
||||
ps_dec->ps_computebs_cur_slice->last_slice_in_frame;
|
||||
|
||||
if(last_slice == 1)
|
||||
break;
|
||||
|
||||
if(parse_addr != computebs_addr)
|
||||
break;
|
||||
|
||||
DEBUG_THREADS_PRINTF("Waiting at compute bs for next slice or end of frame\n");
|
||||
|
||||
NOP(32);
|
||||
|
||||
}
|
||||
|
||||
DEBUG_THREADS_PRINTF("CBS thread:Got next slice/end of frame signal \n ");
|
||||
|
||||
if((void *)ps_dec->ps_parse_cur_slice
|
||||
> (void *)ps_dec->ps_computebs_cur_slice)
|
||||
{
|
||||
ps_dec->ps_computebs_cur_slice++;
|
||||
ps_dec->u2_cur_slice_num_bs++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*Last slice in frame*/
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*deblock remaining MBs*/
|
||||
{
|
||||
UWORD32 u4_num_mbs;
|
||||
|
||||
u4_num_mbs = ps_dec->ps_cur_sps->u2_max_mb_addr
|
||||
- ps_dec->u4_cur_deblk_mb_num + 1;
|
||||
|
||||
DEBUG_PERF_PRINTF("mbs left for deblocking= %d \n",u4_num_mbs);
|
||||
|
||||
if(u4_num_mbs != 0)
|
||||
if(ps_dec->u2_skip_deblock == 0)
|
||||
ih264d_check_mb_map_deblk_wait(ps_dec, u4_num_mbs,
|
||||
ps_tfr_cxt);
|
||||
}
|
||||
}
|
||||
|
||||
ps_dec->u4_start_bs_deblk = 0;
|
||||
ithread_exit(0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -30,5 +30,9 @@ void ih264d_compute_bs_non_mbaff_thread(dec_struct_t * ps_dec,
|
|||
dec_mb_info_t * ps_cur_mb_info,
|
||||
UWORD32 u4_mb_num);
|
||||
|
||||
void ih264d_computebs_deblk_thread(dec_struct_t *ps_dec);
|
||||
void ih264d_recon_deblk_thread(dec_struct_t *ps_dec);
|
||||
void ih264d_check_mb_map_deblk(dec_struct_t *ps_dec,
|
||||
UWORD32 deblk_mb_grp,
|
||||
tfr_ctxt_t *ps_tfr_cxt,
|
||||
UWORD32 u4_check_mb_map);
|
||||
#endif /* _IH264D_THREAD_COMPUTE_BS_H_ */
|
||||
|
|
|
|||
|
|
@ -82,20 +82,18 @@ void ih264d_parse_tfr_nmb(dec_struct_t * ps_dec,
|
|||
// copy into s_frmMbInfo
|
||||
|
||||
u4_mb_num = u4_n_mb_start;
|
||||
ps_dec->ps_parse_cur_slice->u4_num_mbs_done_in_slice += u1_num_mbs;
|
||||
u4_mb_num = (ps_dec->u2_cur_mb_addr + 1) - u1_num_mbs;
|
||||
|
||||
for(i = 0; i < u1_num_mbs; i++)
|
||||
{
|
||||
DATA_SYNC();
|
||||
UPDATE_SLICE_NUM_MAP(ps_dec->pu2_slice_num_map, u4_mb_num,
|
||||
ps_dec->u2_cur_slice_num);
|
||||
DATA_SYNC();
|
||||
UPDATE_MB_MAP_MBNUM_BYTE(ps_dec->pu1_dec_mb_map, u4_mb_num);
|
||||
|
||||
u4_mb_num++;
|
||||
}
|
||||
|
||||
DATA_SYNC();
|
||||
/****************************************************************/
|
||||
/* Check for End Of Row in Next iteration */
|
||||
/****************************************************************/
|
||||
|
|
@ -160,16 +158,9 @@ void ih264d_parse_tfr_nmb(dec_struct_t * ps_dec,
|
|||
ps_dec->ps_mv_left = ps_dec->ps_mv_cur
|
||||
+ ps_dec->s_tran_addrecon.u2_mv_left_inc;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ps_dec->ps_mv_cur += (u1_num_mbs << 4);
|
||||
ps_dec->u4_num_mbs_prev_nmb = u1_num_mbs;
|
||||
|
||||
|
||||
ps_dec->u4_dma_buf_idx = 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -186,11 +177,8 @@ void ih264d_decode_tfr_nmb(dec_struct_t * ps_dec,
|
|||
/****************************************************************/
|
||||
/* Check for End Of Row in Next iteration */
|
||||
/****************************************************************/
|
||||
u1_end_of_row_next =
|
||||
u1_num_mbs_next
|
||||
&& ((u1_num_mbs_next)
|
||||
<= (ps_dec->u1_recon_mb_grp
|
||||
>> u1_mbaff));
|
||||
u1_end_of_row_next = u1_num_mbs_next &&
|
||||
((u1_num_mbs_next) <= (ps_dec->u1_recon_mb_grp >> u1_mbaff));
|
||||
|
||||
/****************************************************************/
|
||||
/* Transfer the Following things */
|
||||
|
|
@ -207,23 +195,12 @@ void ih264d_decode_tfr_nmb(dec_struct_t * ps_dec,
|
|||
ih264d_transfer_mb_group_data(ps_dec, u1_num_mbs, u1_end_of_row,
|
||||
u1_end_of_row_next);
|
||||
|
||||
if(u1_end_of_row)
|
||||
{
|
||||
/* Reset the N-Mb Recon Buf Index to default Values */
|
||||
ps_dec->u2_mb_group_cols_y1 = ps_dec->u2_mb_group_cols_y;
|
||||
ps_dec->u2_mb_group_cols_cr1 = ps_dec->u2_mb_group_cols_cr;
|
||||
}
|
||||
/* If next N-Mb Group is the EndOfRow, set the N-Mb Recon Buf Index */
|
||||
else if(u1_end_of_row_next)
|
||||
{
|
||||
ps_dec->u2_mb_group_cols_y1 = (u1_num_mbs_next << 4) + 8;
|
||||
ps_dec->u2_mb_group_cols_cr1 = (u1_num_mbs_next << 3) + 8;
|
||||
}
|
||||
}
|
||||
|
||||
WORD32 ih264d_decode_recon_tfr_nmb_thread(dec_struct_t * ps_dec, UWORD8 u1_num_mbs, // number of MBs loop should run
|
||||
UWORD8 u1_num_mbs_next,
|
||||
UWORD8 u1_end_of_row)
|
||||
WORD32 ih264d_decode_recon_tfr_nmb_thread(dec_struct_t * ps_dec,
|
||||
UWORD8 u1_num_mbs,
|
||||
UWORD8 u1_num_mbs_next,
|
||||
UWORD8 u1_end_of_row)
|
||||
{
|
||||
WORD32 i,j;
|
||||
dec_mb_info_t * ps_cur_mb_info;
|
||||
|
|
@ -235,54 +212,65 @@ WORD32 ih264d_decode_recon_tfr_nmb_thread(dec_struct_t * ps_dec, UWORD8 u1_num_m
|
|||
UWORD32 u4_cond;
|
||||
UWORD16 u2_slice_num,u2_cur_dec_mb_num;
|
||||
WORD32 ret;
|
||||
|
||||
UWORD32 u4_mb_num;
|
||||
WORD32 nop_cnt = 8*128;
|
||||
u1_slice_type = ps_dec->ps_decode_cur_slice->slice_type;
|
||||
|
||||
u1_B = (u1_slice_type == B_SLICE);
|
||||
|
||||
u1_skip_th =
|
||||
((u1_slice_type != I_SLICE) ?
|
||||
u1_skip_th = ((u1_slice_type != I_SLICE) ?
|
||||
(u1_B ? B_8x8 : PRED_8x8R0) : -1);
|
||||
|
||||
u1_ipcm_th = ((u1_slice_type != I_SLICE) ? (u1_B ? 23 : 5) : 0);
|
||||
|
||||
u2_cur_dec_mb_num = ps_dec->cur_dec_mb_num;
|
||||
|
||||
/* N Mb MC Loop */
|
||||
for(i = 0; i < u1_num_mbs; i++)
|
||||
while(1)
|
||||
{
|
||||
DATA_SYNC();
|
||||
|
||||
// check dec_mb_map
|
||||
UWORD32 yield_cnt = 0, u4_max_addr;
|
||||
UWORD32 u4_max_mb = (UWORD32)(ps_dec->i2_dec_thread_mb_y + (1 << u1_mbaff)) * ps_dec->u2_frm_wd_in_mbs - 1;
|
||||
u4_mb_num = u2_cur_dec_mb_num;
|
||||
/*introducing 1 MB delay*/
|
||||
u4_mb_num = MIN(u4_mb_num + u1_num_mbs + 1, u4_max_mb);
|
||||
|
||||
u4_max_addr = ps_dec->ps_cur_sps->u2_max_mb_addr;
|
||||
while(1)
|
||||
CHECK_MB_MAP_BYTE(u4_mb_num, ps_dec->pu1_dec_mb_map, u4_cond);
|
||||
if(u4_cond)
|
||||
{
|
||||
UWORD32 u4_mb_num = u2_cur_dec_mb_num;
|
||||
|
||||
/*introducing 1 MB delay*/
|
||||
if(u4_mb_num < u4_max_addr)
|
||||
u4_mb_num = u4_mb_num + 1;
|
||||
|
||||
CHECK_MB_MAP_BYTE(u4_mb_num, ps_dec->pu1_dec_mb_map, u4_cond);
|
||||
if(u4_cond)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(nop_cnt > 0)
|
||||
{
|
||||
break;
|
||||
nop_cnt -= 128;
|
||||
NOP(128);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(ps_dec->u4_output_present && (2 == ps_dec->u4_num_cores) &&
|
||||
(ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht))
|
||||
{
|
||||
NOP(128);
|
||||
|
||||
ps_dec->u4_fmt_conv_num_rows =
|
||||
MIN(FMT_CONV_NUM_ROWS,
|
||||
(ps_dec->s_disp_frame_info.u4_y_ht
|
||||
- ps_dec->u4_fmt_conv_cur_row));
|
||||
ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op),
|
||||
ps_dec->u4_fmt_conv_cur_row,
|
||||
ps_dec->u4_fmt_conv_num_rows);
|
||||
ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
|
||||
}
|
||||
else
|
||||
{
|
||||
nop_cnt = 8*128;
|
||||
ithread_yield();
|
||||
}
|
||||
|
||||
DEBUG_THREADS_PRINTF("waiting for mb mapcur_dec_mb_num = %d,ps_dec->u2_cur_mb_addr = %d\n",u2_cur_dec_mb_num,
|
||||
ps_dec->u2_cur_mb_addr);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/* N Mb MC Loop */
|
||||
for(i = 0; i < u1_num_mbs; i++)
|
||||
{
|
||||
u4_mb_num = u2_cur_dec_mb_num;
|
||||
|
||||
GET_SLICE_NUM_MAP(ps_dec->pu2_slice_num_map, u2_cur_dec_mb_num,
|
||||
u2_slice_num);
|
||||
|
|
@ -293,66 +281,56 @@ WORD32 ih264d_decode_recon_tfr_nmb_thread(dec_struct_t * ps_dec, UWORD8 u1_num_m
|
|||
break;
|
||||
}
|
||||
|
||||
ps_cur_mb_info = &ps_dec->ps_frm_mb_info[u2_cur_dec_mb_num
|
||||
& PD_MB_BUF_SIZE_MOD];
|
||||
ps_cur_mb_info = &ps_dec->ps_frm_mb_info[u2_cur_dec_mb_num];
|
||||
|
||||
ps_dec->u4_dma_buf_idx = 0;
|
||||
ps_dec->u4_pred_info_idx = 0;
|
||||
|
||||
if(ps_cur_mb_info->u1_mb_type <= u1_skip_th)
|
||||
{
|
||||
WORD32 pred_cnt = 0;
|
||||
pred_info_pkd_t *ps_pred_pkd;
|
||||
UWORD32 u4_pred_info_pkd_idx;
|
||||
WORD8 i1_pred;
|
||||
|
||||
u4_pred_info_pkd_idx = ps_cur_mb_info->u4_pred_info_pkd_idx;
|
||||
|
||||
while(pred_cnt < ps_cur_mb_info->u1_num_pred_parts)
|
||||
{
|
||||
WORD32 pred_cnt = 0;
|
||||
pred_info_pkd_t *ps_pred_pkd;
|
||||
UWORD32 u4_pred_info_pkd_idx;
|
||||
WORD8 i1_pred;
|
||||
ps_pred_pkd = ps_dec->ps_pred_pkd + u4_pred_info_pkd_idx;
|
||||
|
||||
u4_pred_info_pkd_idx = ps_cur_mb_info->u4_pred_info_pkd_idx;
|
||||
ps_dec->p_form_mb_part_info_thread(ps_pred_pkd,ps_dec,
|
||||
ps_cur_mb_info->u2_mbx,
|
||||
ps_cur_mb_info->u2_mby,
|
||||
(i >> u1_mbaff),
|
||||
ps_cur_mb_info);
|
||||
|
||||
while(pred_cnt < ps_cur_mb_info->u1_num_pred_parts)
|
||||
{
|
||||
|
||||
ps_pred_pkd = ps_dec->ps_pred_pkd + u4_pred_info_pkd_idx;
|
||||
|
||||
|
||||
ps_dec->p_form_mb_part_info_thread(ps_pred_pkd,ps_dec,
|
||||
ps_cur_mb_info->u2_mbx,ps_cur_mb_info->u2_mby,(i >> u1_mbaff),
|
||||
ps_cur_mb_info);
|
||||
|
||||
u4_pred_info_pkd_idx++;
|
||||
pred_cnt++;
|
||||
|
||||
}
|
||||
u4_pred_info_pkd_idx++;
|
||||
pred_cnt++;
|
||||
}
|
||||
ps_dec->p_mc_dec_thread(ps_dec, ps_cur_mb_info);
|
||||
}
|
||||
else if(ps_cur_mb_info->u1_mb_type == MB_SKIP)
|
||||
{
|
||||
WORD32 pred_cnt = 0;
|
||||
pred_info_pkd_t *ps_pred_pkd;
|
||||
UWORD32 u4_pred_info_pkd_idx;
|
||||
WORD8 i1_pred;
|
||||
|
||||
u4_pred_info_pkd_idx = ps_cur_mb_info->u4_pred_info_pkd_idx;
|
||||
|
||||
while(pred_cnt < ps_cur_mb_info->u1_num_pred_parts)
|
||||
{
|
||||
WORD32 pred_cnt = 0;
|
||||
pred_info_pkd_t *ps_pred_pkd;
|
||||
UWORD32 u4_pred_info_pkd_idx;
|
||||
WORD8 i1_pred;
|
||||
ps_pred_pkd = ps_dec->ps_pred_pkd + u4_pred_info_pkd_idx;
|
||||
|
||||
u4_pred_info_pkd_idx = ps_cur_mb_info->u4_pred_info_pkd_idx;
|
||||
ps_dec->p_form_mb_part_info_thread(ps_pred_pkd,ps_dec,
|
||||
ps_cur_mb_info->u2_mbx,
|
||||
ps_cur_mb_info->u2_mby,
|
||||
(i >> u1_mbaff),
|
||||
ps_cur_mb_info);
|
||||
|
||||
|
||||
|
||||
while(pred_cnt < ps_cur_mb_info->u1_num_pred_parts)
|
||||
{
|
||||
|
||||
ps_pred_pkd = ps_dec->ps_pred_pkd + u4_pred_info_pkd_idx;
|
||||
|
||||
|
||||
ps_dec->p_form_mb_part_info_thread(ps_pred_pkd,ps_dec,
|
||||
ps_cur_mb_info->u2_mbx,ps_cur_mb_info->u2_mby,(i >> u1_mbaff),
|
||||
ps_cur_mb_info);
|
||||
|
||||
|
||||
u4_pred_info_pkd_idx++;
|
||||
pred_cnt++;
|
||||
}
|
||||
u4_pred_info_pkd_idx++;
|
||||
pred_cnt++;
|
||||
}
|
||||
/* Decode MB skip */
|
||||
ps_dec->p_mc_dec_thread(ps_dec, ps_cur_mb_info);
|
||||
|
|
@ -363,61 +341,83 @@ WORD32 ih264d_decode_recon_tfr_nmb_thread(dec_struct_t * ps_dec, UWORD8 u1_num_m
|
|||
|
||||
/* N Mb IQ IT RECON Loop */
|
||||
for(j = 0; j < i; j++)
|
||||
{
|
||||
DATA_SYNC();
|
||||
{
|
||||
ps_cur_mb_info = &ps_dec->ps_frm_mb_info[ps_dec->cur_dec_mb_num];
|
||||
|
||||
if((ps_dec->u4_num_cores == 2) || !ps_dec->i1_recon_in_thread3_flag)
|
||||
{
|
||||
if(ps_cur_mb_info->u1_mb_type <= u1_skip_th)
|
||||
{
|
||||
ih264d_process_inter_mb(ps_dec, ps_cur_mb_info, j);
|
||||
}
|
||||
else if(ps_cur_mb_info->u1_mb_type != MB_SKIP)
|
||||
{
|
||||
if((u1_ipcm_th + 25) != ps_cur_mb_info->u1_mb_type)
|
||||
{
|
||||
ps_cur_mb_info->u1_mb_type -= (u1_skip_th + 1);
|
||||
ih264d_process_intra_mb(ps_dec, ps_cur_mb_info, j);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ps_cur_mb_info = &ps_dec->ps_frm_mb_info[ps_dec->cur_dec_mb_num
|
||||
& PD_MB_BUF_SIZE_MOD];
|
||||
if(ps_dec->u4_use_intrapred_line_copy == 1)
|
||||
ih264d_copy_intra_pred_line(ps_dec, ps_cur_mb_info, j);
|
||||
}
|
||||
|
||||
DATA_SYNC();
|
||||
|
||||
if(ps_cur_mb_info->u1_mb_type <= u1_skip_th)
|
||||
{
|
||||
ih264d_process_inter_mb(ps_dec, ps_cur_mb_info, j);
|
||||
}
|
||||
else if(ps_cur_mb_info->u1_mb_type != MB_SKIP)
|
||||
{
|
||||
if((u1_ipcm_th + 25) != ps_cur_mb_info->u1_mb_type)
|
||||
{
|
||||
ps_cur_mb_info->u1_mb_type -= (u1_skip_th + 1);
|
||||
ret = ih264d_process_intra_mb(ps_dec, ps_cur_mb_info, j);
|
||||
if(ret != OK)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if(ps_dec->u4_mb_level_deblk == 1)
|
||||
{
|
||||
|
||||
ih264d_deblock_mb_level(ps_dec, ps_cur_mb_info, j);
|
||||
}
|
||||
|
||||
if((ps_dec->u4_num_cores >= 3) && (u1_mbaff == 0))
|
||||
ih264d_copy_intra_pred_line(ps_dec, ps_cur_mb_info, j);
|
||||
if(u1_mbaff)
|
||||
{
|
||||
if(u4_update_mbaff)
|
||||
{
|
||||
UWORD32 u4_mb_num = ps_cur_mb_info->u2_mbx
|
||||
+ ps_dec->u2_frm_wd_in_mbs
|
||||
* (ps_cur_mb_info->u2_mby >> 1);
|
||||
UPDATE_MB_MAP_MBNUM_BYTE(ps_dec->pu1_recon_mb_map, u4_mb_num);
|
||||
u4_update_mbaff = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
u4_update_mbaff = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UWORD32 u4_mb_num = ps_cur_mb_info->u2_mbx
|
||||
+ ps_dec->u2_frm_wd_in_mbs * ps_cur_mb_info->u2_mby;
|
||||
UPDATE_MB_MAP_MBNUM_BYTE(ps_dec->pu1_recon_mb_map, u4_mb_num);
|
||||
}
|
||||
ps_dec->cur_dec_mb_num++;
|
||||
if(u1_mbaff)
|
||||
{
|
||||
if(u4_update_mbaff)
|
||||
{
|
||||
UWORD32 u4_mb_num = ps_cur_mb_info->u2_mbx
|
||||
+ ps_dec->u2_frm_wd_in_mbs
|
||||
* (ps_cur_mb_info->u2_mby >> 1);
|
||||
UPDATE_MB_MAP_MBNUM_BYTE(ps_dec->pu1_recon_mb_map, u4_mb_num);
|
||||
u4_update_mbaff = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
u4_update_mbaff = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UWORD32 u4_mb_num = ps_cur_mb_info->u2_mbx
|
||||
+ ps_dec->u2_frm_wd_in_mbs * ps_cur_mb_info->u2_mby;
|
||||
UPDATE_MB_MAP_MBNUM_BYTE(ps_dec->pu1_recon_mb_map, u4_mb_num);
|
||||
}
|
||||
ps_dec->cur_dec_mb_num++;
|
||||
}
|
||||
|
||||
/*N MB deblocking*/
|
||||
if(ps_dec->u4_nmb_deblk == 1)
|
||||
{
|
||||
UWORD32 u4_wd_y, u4_wd_uv;
|
||||
tfr_ctxt_t *ps_tfr_cxt = &(ps_dec->s_tran_addrecon);
|
||||
UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag;
|
||||
const WORD32 i4_cb_qp_idx_ofst =
|
||||
ps_dec->ps_cur_pps->i1_chroma_qp_index_offset;
|
||||
const WORD32 i4_cr_qp_idx_ofst =
|
||||
ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset;
|
||||
|
||||
u4_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag;
|
||||
u4_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag;
|
||||
|
||||
ps_cur_mb_info = &ps_dec->ps_frm_mb_info[ps_dec->u4_cur_deblk_mb_num];
|
||||
|
||||
ps_dec->u4_deblk_mb_x = ps_cur_mb_info->u2_mbx;
|
||||
ps_dec->u4_deblk_mb_y = ps_cur_mb_info->u2_mby;
|
||||
|
||||
|
||||
for(j = 0; j < i; j++)
|
||||
{
|
||||
ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt,
|
||||
i4_cb_qp_idx_ofst, i4_cr_qp_idx_ofst,
|
||||
u4_wd_y, u4_wd_uv);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*handle the last mb in picture case*/
|
||||
if(ps_dec->cur_dec_mb_num > ps_dec->ps_cur_sps->u2_max_mb_addr)
|
||||
|
|
@ -435,19 +435,13 @@ WORD32 ih264d_decode_recon_tfr_nmb_thread(dec_struct_t * ps_dec, UWORD8 u1_num_m
|
|||
return OK;
|
||||
}
|
||||
|
||||
WORD32 ih264d_decode_slice_thread(dec_struct_t *ps_dec /* Decoder parameters */
|
||||
)
|
||||
WORD32 ih264d_decode_slice_thread(dec_struct_t *ps_dec)
|
||||
{
|
||||
UWORD8 u1_num_mbs_next, u1_num_mbsleft, u1_end_of_row = 0; //, u1_slice_end, u1_tfr_n_mb, u1_decode_nmb;
|
||||
UWORD8 u1_num_mbs_next, u1_num_mbsleft, u1_end_of_row = 0;
|
||||
const UWORD32 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs;
|
||||
UWORD8 u1_mbaff, u1_num_mbs; //,uc_more_data_flag,u1_mb_idx;
|
||||
UWORD8 u1_mbaff, u1_num_mbs;
|
||||
|
||||
UWORD16 u2_first_mb_in_slice;
|
||||
|
||||
/*dec_bit_stream_t *const ps_bitstrm = ps_dec->ps_bitstrm;
|
||||
UWORD32 * pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
|
||||
UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;*/
|
||||
|
||||
UWORD16 i16_mb_x, i16_mb_y;
|
||||
UWORD8 u1_field_pic;
|
||||
UWORD32 u4_frame_stride, x_offset, y_offset;
|
||||
|
|
@ -455,8 +449,46 @@ WORD32 ih264d_decode_slice_thread(dec_struct_t *ps_dec /* Decoder parameters */
|
|||
|
||||
tfr_ctxt_t *ps_trns_addr;
|
||||
|
||||
if(ps_dec->ps_decode_cur_slice->slice_header_done != 2)
|
||||
return ERROR_INV_SLICE_HDR_T;
|
||||
/*check for mb map of first mb in slice to ensure slice header is parsed*/
|
||||
while(1)
|
||||
{
|
||||
UWORD32 u4_mb_num = ps_dec->cur_dec_mb_num;
|
||||
UWORD32 u4_cond = 0;
|
||||
WORD32 nop_cnt = 8 * 128;
|
||||
CHECK_MB_MAP_BYTE(u4_mb_num, ps_dec->pu1_dec_mb_map, u4_cond);
|
||||
if(u4_cond)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(nop_cnt > 0)
|
||||
{
|
||||
nop_cnt -= 128;
|
||||
NOP(128);
|
||||
}
|
||||
else if(ps_dec->u4_output_present && (2 == ps_dec->u4_num_cores) &&
|
||||
(ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht))
|
||||
{
|
||||
ps_dec->u4_fmt_conv_num_rows =
|
||||
MIN(FMT_CONV_NUM_ROWS,
|
||||
(ps_dec->s_disp_frame_info.u4_y_ht
|
||||
- ps_dec->u4_fmt_conv_cur_row));
|
||||
ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op),
|
||||
ps_dec->u4_fmt_conv_cur_row,
|
||||
ps_dec->u4_fmt_conv_num_rows);
|
||||
ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
|
||||
}
|
||||
else
|
||||
{
|
||||
nop_cnt = 8*128;
|
||||
ithread_yield();
|
||||
}
|
||||
DEBUG_THREADS_PRINTF("waiting for mb mapcur_dec_mb_num = %d,ps_dec->u2_cur_mb_addr = %d\n",u2_cur_dec_mb_num,
|
||||
ps_dec->u2_cur_mb_addr);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -469,20 +501,15 @@ WORD32 ih264d_decode_slice_thread(dec_struct_t *ps_dec /* Decoder parameters */
|
|||
i16_mb_y <<= u1_mbaff;
|
||||
ps_dec->i2_dec_thread_mb_y = i16_mb_y;
|
||||
|
||||
/*if((i16_mb_x > (i2_pic_wdin_mbs - 1))
|
||||
|| (i16_mb_y > ps_dec->u2_frm_ht_in_mbs - 1))
|
||||
{
|
||||
}*/
|
||||
if(ps_dec->cur_dec_mb_num == u2_first_mb_in_slice << u1_mbaff)
|
||||
{
|
||||
ps_dec->u2_mb_skip_error = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_dec->u2_mb_skip_error = 1;
|
||||
}
|
||||
|
||||
ps_dec->cur_dec_mb_num = u2_first_mb_in_slice << u1_mbaff;
|
||||
|
||||
if((ps_dec->u4_num_cores == 2) || !ps_dec->i1_recon_in_thread3_flag)
|
||||
{
|
||||
ps_dec->pv_proc_tu_coeff_data =
|
||||
(void *) ps_dec->ps_decode_cur_slice->pv_tu_coeff_data_start;
|
||||
}
|
||||
|
||||
// recalculate recon pointers
|
||||
u1_field_pic = ps_dec->ps_cur_slice->u1_field_pic_flag;
|
||||
u4_frame_stride = ps_dec->u2_frm_wd_y << u1_field_pic;
|
||||
|
|
@ -506,17 +533,6 @@ WORD32 ih264d_decode_slice_thread(dec_struct_t *ps_dec /* Decoder parameters */
|
|||
ps_trns_addr->pu1_mb_u = ps_trns_addr->pu1_dest_u;
|
||||
ps_trns_addr->pu1_mb_v = ps_trns_addr->pu1_dest_v;
|
||||
|
||||
if(ps_dec->u4_mb_level_deblk == 1)
|
||||
{
|
||||
/*If it is not the first mb in row,the previous MB which needs to be deblocked
|
||||
* as there is delay of 1 MB*/
|
||||
if(i16_mb_x != 0)
|
||||
{
|
||||
ps_trns_addr->pu1_mb_y -= MB_SIZE;
|
||||
ps_trns_addr->pu1_mb_u -= BLK8x8SIZE * YUV420SP_FACTOR;
|
||||
ps_trns_addr->pu1_mb_v -= BLK8x8SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
/**********Number of Mbs in Slice**********/
|
||||
|
||||
|
|
@ -582,126 +598,49 @@ WORD32 ih264d_decode_slice_thread(dec_struct_t *ps_dec /* Decoder parameters */
|
|||
|
||||
void ih264d_decode_picture_thread(dec_struct_t *ps_dec )
|
||||
{
|
||||
|
||||
ithread_set_name("ih264d_decode_picture_thread");
|
||||
|
||||
// run the loop till all slices are decoded
|
||||
|
||||
while(1)
|
||||
{
|
||||
if(ps_dec->u4_start_frame_decode)
|
||||
/*Complete all writes before processing next slice*/
|
||||
|
||||
DEBUG_THREADS_PRINTF(" Entering decode slice\n");
|
||||
|
||||
ih264d_decode_slice_thread(ps_dec);
|
||||
DEBUG_THREADS_PRINTF(" Exit ih264d_decode_slice_thread \n");
|
||||
|
||||
|
||||
if(ps_dec->cur_dec_mb_num
|
||||
> ps_dec->ps_cur_sps->u2_max_mb_addr)
|
||||
{
|
||||
/*Last slice in frame*/
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
NOP(32);
|
||||
|
||||
ps_dec->ps_decode_cur_slice++;
|
||||
ps_dec->u2_cur_slice_num_dec_thread++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DEBUG_THREADS_PRINTF("Got start of frame u4_flag\n");
|
||||
|
||||
if(ps_dec->u4_start_frame_decode == 1)
|
||||
if(ps_dec->u4_output_present && (2 == ps_dec->u4_num_cores) &&
|
||||
(ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht))
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
/*Complete all writes before processing next slice*/
|
||||
DATA_SYNC();
|
||||
/*wait untill all the slice params have been populated*/
|
||||
while(ps_dec->ps_decode_cur_slice->slice_header_done == 0)
|
||||
{
|
||||
NOP(32); DEBUG_THREADS_PRINTF(" waiting for slice header \n");
|
||||
}
|
||||
|
||||
DEBUG_THREADS_PRINTF(" Entering decode slice\n");
|
||||
|
||||
ih264d_decode_slice_thread(ps_dec);
|
||||
DEBUG_THREADS_PRINTF(" Exit ih264d_decode_slice_thread \n");
|
||||
|
||||
/*Complete all writes before processing next slice*/
|
||||
DATA_SYNC();
|
||||
|
||||
while(1)
|
||||
{
|
||||
volatile void * parse_addr, *dec_addr;
|
||||
volatile UWORD32 last_slice;
|
||||
|
||||
parse_addr = (volatile void *)ps_dec->ps_parse_cur_slice;
|
||||
dec_addr = (volatile void *)ps_dec->ps_decode_cur_slice;
|
||||
last_slice = ps_dec->ps_decode_cur_slice->last_slice_in_frame;
|
||||
|
||||
if(last_slice == 1)
|
||||
break;
|
||||
|
||||
if(parse_addr != dec_addr)
|
||||
break;
|
||||
|
||||
DEBUG_THREADS_PRINTF("Waiting for next slice or end of frame\n");
|
||||
|
||||
NOP(32);
|
||||
}
|
||||
|
||||
DEBUG_THREADS_PRINTF("Got next slice/end of frame signal \n ");
|
||||
|
||||
if((void *)ps_dec->ps_parse_cur_slice
|
||||
> (void *)ps_dec->ps_decode_cur_slice)
|
||||
{
|
||||
ps_dec->ps_decode_cur_slice++;
|
||||
ps_dec->u2_cur_slice_num_dec_thread++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*Last slice in frame*/
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(ps_dec->u4_output_present)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
volatile UWORD32 *u4_flag = &(ps_dec->as_fmt_conv_part[1].u4_flag);
|
||||
|
||||
DEBUG_THREADS_PRINTF(" Format conversion loop in decode *u4_flag = %d\n",*u4_flag);
|
||||
if(2 == *u4_flag)
|
||||
{
|
||||
if(ps_dec->as_fmt_conv_part[1].u4_num_rows_y)
|
||||
ih264d_format_convert(
|
||||
ps_dec, &(ps_dec->s_disp_op),
|
||||
ps_dec->as_fmt_conv_part[1].u4_start_y,
|
||||
ps_dec->as_fmt_conv_part[1].u4_num_rows_y);
|
||||
|
||||
break;
|
||||
}
|
||||
else if(1 == *u4_flag)
|
||||
{
|
||||
NOP(32);
|
||||
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
}
|
||||
ps_dec->u4_fmt_conv_num_rows =
|
||||
(ps_dec->s_disp_frame_info.u4_y_ht
|
||||
- ps_dec->u4_fmt_conv_cur_row);
|
||||
ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op),
|
||||
ps_dec->u4_fmt_conv_cur_row,
|
||||
ps_dec->u4_fmt_conv_num_rows);
|
||||
ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
|
||||
}
|
||||
|
||||
ithread_exit(0);
|
||||
|
||||
}
|
||||
|
||||
void ih264d_signal_decode_thread(dec_struct_t *ps_dec)
|
||||
{
|
||||
if(ps_dec->u4_dec_thread_created == 1)
|
||||
{
|
||||
|
||||
if(ps_dec->u4_start_frame_decode == 1)
|
||||
ps_dec->ps_parse_cur_slice->last_slice_in_frame = 1;
|
||||
else
|
||||
/*to indicate frame in error*/
|
||||
ps_dec->u4_start_frame_decode = 2;
|
||||
|
||||
ithread_join(ps_dec->pv_dec_thread_handle, NULL);
|
||||
ps_dec->u4_dec_thread_created = 0;
|
||||
}
|
||||
|
|
@ -710,10 +649,6 @@ void ih264d_signal_bs_deblk_thread(dec_struct_t *ps_dec)
|
|||
{
|
||||
if(ps_dec->u4_bs_deblk_thread_created)
|
||||
{
|
||||
/*signal error*/
|
||||
if(ps_dec->u4_start_bs_deblk == 0)
|
||||
ps_dec->u4_start_bs_deblk = 2;
|
||||
|
||||
ithread_join(ps_dec->pv_bs_deblk_thread_handle, NULL);
|
||||
ps_dec->u4_bs_deblk_thread_created = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ void ih264d_decode_tfr_nmb(dec_struct_t *ps_dec,
|
|||
UWORD8 u1_num_mbs,
|
||||
UWORD8 u1_num_mbs_next,
|
||||
UWORD8 u1_end_of_row);
|
||||
WORD32 ih264d_decode_recon_tfr_nmb_thread(dec_struct_t *ps_dec,
|
||||
WORD32 ih264d_decode_recon_tfr_nmb_thread(dec_struct_t * ps_dec,
|
||||
UWORD8 u1_num_mbs,
|
||||
UWORD8 u1_num_mbs_next,
|
||||
UWORD8 u1_end_of_row);
|
||||
|
|
|
|||
|
|
@ -596,17 +596,8 @@ WORD32 ih264d_get_dpb_size(dec_seq_params_t *ps_seq, dec_struct_t *ps_dec)
|
|||
WORD32 i4_size;
|
||||
UWORD8 u1_level_idc;
|
||||
|
||||
|
||||
u1_level_idc = ps_seq->u1_level_idc; //harcode for the time being
|
||||
|
||||
#if DPB_HACK
|
||||
u1_level_idc = (u1_level_idc < 30) ? 30 : u1_level_idc;
|
||||
u1_level_idc = (u1_level_idc > 30) ? 30 : u1_level_idc;
|
||||
#endif
|
||||
|
||||
u1_level_idc = MIN(u1_level_idc, ps_dec->u4_level_at_init);
|
||||
//DPB_HACK
|
||||
|
||||
|
||||
switch(u1_level_idc)
|
||||
{
|
||||
|
|
@ -658,29 +649,10 @@ WORD32 ih264d_get_dpb_size(dec_seq_params_t *ps_seq, dec_struct_t *ps_dec)
|
|||
default:
|
||||
i4_size = 6912000;
|
||||
break;
|
||||
/*
|
||||
* Not calling the error handler if the level has come wrong.
|
||||
*/
|
||||
/*{
|
||||
UWORD32 i4_error_code;
|
||||
i4_error_code = ERROR_UNKNOWN_LEVEL ;
|
||||
|
||||
}
|
||||
break;*/
|
||||
}
|
||||
|
||||
/* Temporary hack to run Tractor Cav/Cab/MbAff Profiler ps_bitstrm */
|
||||
#if DPB_HACK
|
||||
i4_size = 6912000;
|
||||
#endif
|
||||
|
||||
i4_size =
|
||||
i4_size
|
||||
/ (ps_seq->u2_frm_wd_in_mbs
|
||||
* (ps_seq->u2_frm_ht_in_mbs
|
||||
<< (1
|
||||
- ps_seq->u1_frame_mbs_only_flag)));
|
||||
i4_size = i4_size / 384; // temp / (256 * 1.5)
|
||||
i4_size /= (ps_seq->u2_frm_wd_in_mbs * (ps_seq->u2_frm_ht_in_mbs << (1 - ps_seq->u1_frame_mbs_only_flag)));
|
||||
i4_size /= 384;
|
||||
i4_size = MIN(i4_size, 16);
|
||||
i4_size = MAX(i4_size, 1);
|
||||
return (i4_size);
|
||||
|
|
@ -963,7 +935,6 @@ WORD32 ih264d_init_pic(dec_struct_t *ps_dec,
|
|||
ps_dec->u2_frm_ht_in_mbs = (ps_dec->u2_pic_ht
|
||||
>> (4 + ps_dec->ps_cur_slice->u1_field_pic_flag));
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* If change in Level or the required PicBuffers i4_size is more than the */
|
||||
/* current one FREE the current PicBuffers and allocate affresh */
|
||||
|
|
@ -994,10 +965,6 @@ WORD32 ih264d_init_pic(dec_struct_t *ps_dec,
|
|||
ps_dec->u1_max_dec_frame_buffering = ih264d_get_dpb_size(ps_seq,
|
||||
ps_dec);
|
||||
|
||||
if(ps_dec->u4_share_disp_buf)
|
||||
ps_dec->u1_max_dec_frame_buffering = MAX(
|
||||
ps_dec->u1_max_dec_frame_buffering, 5);
|
||||
|
||||
ps_dec->u1_max_dec_frame_buffering = MIN(
|
||||
ps_dec->u1_max_dec_frame_buffering,
|
||||
ps_dec->u4_num_ref_frames_at_init);
|
||||
|
|
@ -2070,10 +2037,6 @@ WORD32 ih264d_create_pic_buffers(UWORD8 u1_num_of_buf,
|
|||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
//WORD16 i16_res_coeff[2 * 3600 * (MB_LUM_SIZE + 2 * MB_CHROM_SIZE)];
|
||||
//pred_info_t s_pred_frame[4000 * 60];
|
||||
//pred_info_t *ps_pred_frame;
|
||||
|
||||
WORD16 ih264d_get_memory_dec_params(dec_struct_t * ps_dec)
|
||||
{
|
||||
struct MemReq s_MemReq;
|
||||
|
|
@ -2101,6 +2064,7 @@ WORD16 ih264d_get_memory_dec_params(dec_struct_t * ps_dec)
|
|||
UWORD8 *pu1_buf;
|
||||
|
||||
ps_dec->ps_deblk_pic = ps_dec->ps_mem_tab[MEM_REC_DEBLK_MB_INFO].pv_base;
|
||||
memset(ps_dec->ps_deblk_pic, 0, ps_dec->ps_mem_tab[MEM_REC_DEBLK_MB_INFO].u4_mem_size);
|
||||
|
||||
ps_dec->pu1_dec_mb_map = ps_dec->ps_mem_tab[MEM_REC_PARSE_MAP].pv_base;
|
||||
|
||||
|
|
@ -2159,14 +2123,13 @@ WORD16 ih264d_get_memory_dec_params(dec_struct_t * ps_dec)
|
|||
* ps_sps->u1_num_ref_frames);
|
||||
u4_scratch_mem_used = ALIGN64(u4_scratch_mem_used);
|
||||
|
||||
ps_dec->pu1_ref_buff = (void *)(pu1_scratch_mem_base
|
||||
+ u4_scratch_mem_used);
|
||||
u4_scratch_mem_used += MAX_REF_BUF_SIZE;
|
||||
ps_dec->pu1_ref_buff = pu1_scratch_mem_base + u4_scratch_mem_used + MAX_REF_BUF_SIZE;
|
||||
u4_scratch_mem_used += MAX_REF_BUF_SIZE * 2;
|
||||
u4_scratch_mem_used = ALIGN64(u4_scratch_mem_used);
|
||||
ps_dec->pi2_pred1 =
|
||||
(void *)(pu1_scratch_mem_base + u4_scratch_mem_used);
|
||||
u4_scratch_mem_used += ((sizeof(WORD16)) * PRED_BUFFER_WIDTH
|
||||
* PRED_BUFFER_HEIGHT);
|
||||
* PRED_BUFFER_HEIGHT * 2);
|
||||
u4_scratch_mem_used = ALIGN64(u4_scratch_mem_used);
|
||||
|
||||
ps_dec->pu1_temp_mc_buffer = (void *)(pu1_scratch_mem_base
|
||||
|
|
@ -2220,19 +2183,12 @@ WORD16 ih264d_get_memory_dec_params(dec_struct_t * ps_dec)
|
|||
ps_dec->ppv_map_ref_idx_to_poc += OFFSET_MAP_IDX_POC;
|
||||
|
||||
{
|
||||
UWORD32 u4_ref_size;
|
||||
u4_ref_size = MAX_REF_BUF_SIZE;
|
||||
ps_dec->ps_parse_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
|
||||
ps_dec->ps_decode_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
|
||||
ps_dec->ps_computebs_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
|
||||
|
||||
{
|
||||
|
||||
ps_dec->ps_parse_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
|
||||
ps_dec->ps_decode_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
|
||||
ps_dec->ps_computebs_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
|
||||
ps_dec->ps_parse_cur_slice->slice_header_done = 0;
|
||||
|
||||
ps_dec->ps_pred_start = ps_dec->ps_pred;
|
||||
ps_dec->u4_ref_buf_size = u4_ref_size;
|
||||
}
|
||||
ps_dec->ps_pred_start = ps_dec->ps_pred;
|
||||
ps_dec->u4_ref_buf_size = MAX_REF_BUF_SIZE;
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -2357,18 +2313,17 @@ WORD16 ih264d_get_memory_dec_params(dec_struct_t * ps_dec)
|
|||
|
||||
ps_dec->pu1_y_intra_pred_line = (void *)(pu1_persitent_mem_base
|
||||
+ u4_persistent_mem_used);
|
||||
u4_persistent_mem_used += sizeof(UWORD8) * (u4_luma_wd + 16) * 2;
|
||||
u4_persistent_mem_used += sizeof(UWORD8) * ((u4_wd_mbs + 1) * MB_SIZE) * 2;
|
||||
u4_persistent_mem_used = ALIGN64(u4_persistent_mem_used);
|
||||
|
||||
ps_dec->pu1_u_intra_pred_line = (void *)(pu1_persitent_mem_base
|
||||
+ u4_persistent_mem_used);
|
||||
u4_persistent_mem_used += sizeof(UWORD8) * (u4_chroma_wd + 16) * 2
|
||||
* YUV420SP_FACTOR;
|
||||
u4_persistent_mem_used += sizeof(UWORD8) * ((u4_wd_mbs + 1) * MB_SIZE) * 2;
|
||||
u4_persistent_mem_used = ALIGN64(u4_persistent_mem_used);
|
||||
|
||||
ps_dec->pu1_v_intra_pred_line = (void *)(pu1_persitent_mem_base
|
||||
+ u4_persistent_mem_used);
|
||||
u4_persistent_mem_used += sizeof(UWORD8) * (u4_chroma_wd + 16) * 2;
|
||||
u4_persistent_mem_used += sizeof(UWORD8) * ((u4_wd_mbs + 1) * MB_SIZE) * 2;
|
||||
u4_persistent_mem_used = ALIGN64(u4_persistent_mem_used);
|
||||
|
||||
ps_dec->ps_nbr_mb_row = (void *)(pu1_persitent_mem_base
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ typedef enum {
|
|||
IVD_DEC_REF_BUF_NULL = 0x28,
|
||||
IVD_DEC_FRM_SKIPPED = 0x29,
|
||||
IVD_RES_CHANGED = 0x2a,
|
||||
IVD_DUMMY_ELEMENT_FOR_CODEC_EXTENSIONS = 0x300,
|
||||
IVD_DUMMY_ELEMENT_FOR_CODEC_EXTENSIONS = 0xD0,
|
||||
}IVD_ERROR_CODES_T;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,3 +6,4 @@ include $(LOCAL_PATH)/encoder.mk
|
|||
|
||||
# decoder
|
||||
include $(LOCAL_PATH)/decoder.mk
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@
|
|||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define ALIGN8(x) ((((x) + 7) >> 3) << 3)
|
||||
#define NUM_DISPLAY_BUFFERS 4
|
||||
#define DEFAULT_FPS 30
|
||||
|
|
@ -952,6 +954,7 @@ void dump_output(vid_dec_ctx_t *ps_app_ctx,
|
|||
{
|
||||
UWORD8 *buf;
|
||||
|
||||
|
||||
buf = (UWORD8 *)s_dump_disp_frm_buf.pv_y_buf;
|
||||
for(i = 0; i < s_dump_disp_frm_buf.u4_y_ht; i++)
|
||||
{
|
||||
|
|
@ -2271,6 +2274,38 @@ int main(WORD32 argc, CHAR *argv[])
|
|||
codec_exit(ac_error_str);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* set stride */
|
||||
/*****************************************************************************/
|
||||
{
|
||||
ivd_ctl_set_config_ip_t s_ctl_ip;
|
||||
ivd_ctl_set_config_op_t s_ctl_op;
|
||||
|
||||
|
||||
s_ctl_ip.u4_disp_wd = STRIDE;
|
||||
if(1 == s_app_ctx.display)
|
||||
s_ctl_ip.u4_disp_wd = s_app_ctx.get_stride();
|
||||
|
||||
s_ctl_ip.e_frm_skip_mode = IVD_SKIP_NONE;
|
||||
s_ctl_ip.e_frm_out_mode = IVD_DECODE_FRAME_OUT;
|
||||
s_ctl_ip.e_vid_dec_mode = IVD_DECODE_HEADER;
|
||||
s_ctl_ip.e_cmd = IVD_CMD_VIDEO_CTL;
|
||||
s_ctl_ip.e_sub_cmd = IVD_CMD_CTL_SETPARAMS;
|
||||
s_ctl_ip.u4_size = sizeof(ivd_ctl_set_config_ip_t);
|
||||
s_ctl_op.u4_size = sizeof(ivd_ctl_set_config_op_t);
|
||||
|
||||
ret = ivd_api_function((iv_obj_t*)codec_obj, (void *)&s_ctl_ip,
|
||||
(void *)&s_ctl_op);
|
||||
if(ret != IV_SUCCESS)
|
||||
{
|
||||
sprintf(ac_error_str,
|
||||
"\nError in setting the stride");
|
||||
codec_exit(ac_error_str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Input and output buffer allocation */
|
||||
/*****************************************************************************/
|
||||
|
|
@ -2470,7 +2505,7 @@ int main(WORD32 argc, CHAR *argv[])
|
|||
|
||||
if(ret != IV_SUCCESS)
|
||||
{
|
||||
printf("Error in header decode %x\n", s_video_decode_op.u4_error_code);
|
||||
printf("Error in header decode 0x%x\n", s_video_decode_op.u4_error_code);
|
||||
// codec_exit(ac_error_str);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue