Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzzfix #60

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions encoder/ih264e_bitstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ IH264E_ERROR_T ih264e_put_bits(bitstrm_t *ps_bitstrm,
/* 4. insert remaining bits of code starting from msb of cur word */
/* 5. update bitsleft in current word and stream buffer offset */
/********************************************************************/
IH264E_ERROR_T status = IH264E_SUCCESS;
WORD32 i, rem_bits = (code_len - bits_left_in_cw);

/* insert parital code corresponding to bits left in cur word */
Expand All @@ -193,7 +192,8 @@ IH264E_ERROR_T ih264e_put_bits(bitstrm_t *ps_bitstrm,
/* flush the bits in cur word byte by byte and copy to stream */
UWORD8 u1_next_byte = (u4_cur_word >> (i-8)) & 0xFF;

status |= ih264e_put_byte_epb(ps_bitstrm, u1_next_byte);
IH264E_ERROR_T status = ih264e_put_byte_epb(ps_bitstrm, u1_next_byte);
if (status != IH264E_SUCCESS) return status;
}

/* insert the remaining bits from code val into current word */
Expand All @@ -202,7 +202,7 @@ IH264E_ERROR_T ih264e_put_bits(bitstrm_t *ps_bitstrm,
/* update the state variables and return success */
ps_bitstrm->u4_cur_word = u4_cur_word;
ps_bitstrm->i4_bits_left_in_cw = WORD_SIZE - rem_bits;
return (status);
return (IH264E_SUCCESS);

}
}
Expand Down Expand Up @@ -262,7 +262,6 @@ IH264E_ERROR_T ih264e_put_rbsp_trailing_bits(bitstrm_t *ps_bitstrm)
UWORD32 u4_cur_word = ps_bitstrm->u4_cur_word;
WORD32 bits_left_in_cw = ps_bitstrm->i4_bits_left_in_cw;
WORD32 bytes_left_in_cw = (bits_left_in_cw - 1) >> 3;
IH264E_ERROR_T status = IH264E_SUCCESS;

/* insert a 1 at the end of current word and flush all the bits */
u4_cur_word |= (1 << (bits_left_in_cw - 1));
Expand All @@ -275,15 +274,16 @@ IH264E_ERROR_T ih264e_put_rbsp_trailing_bits(bitstrm_t *ps_bitstrm)
/* flush the bits in cur word byte by byte and copy to stream */
UWORD8 u1_next_byte = (u4_cur_word >> (i-8)) & 0xFF;

status |= ih264e_put_byte_epb(ps_bitstrm, u1_next_byte);
IH264E_ERROR_T status = ih264e_put_byte_epb(ps_bitstrm, u1_next_byte);
if (status != IH264E_SUCCESS) return status;
}

/* Default init values for scratch variables of bitstream context */
ps_bitstrm->u4_cur_word = 0;
ps_bitstrm->i4_bits_left_in_cw = WORD_SIZE;
ps_bitstrm->i4_zero_bytes_run = 0;

return (status);
return (IH264E_SUCCESS);
}

/**
Expand Down
9 changes: 5 additions & 4 deletions encoder/ih264e_bitstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,11 @@ static inline IH264E_ERROR_T ih264e_put_byte_epb(bitstrm_t *ps_bitstrm, UWORD8 b
UWORD8 u1_next_byte = (ps_bitstrm->u4_cur_word >> (i - 8)) & 0xFF; \
err |= ih264e_put_byte_epb(ps_bitstrm, u1_next_byte); \
} \
ps_bitstrm->u4_cur_word = 0; \
ps_bitstrm->i4_bits_left_in_cw = WORD_SIZE; \
} \

if (err == IH264E_SUCCESS) { \
ps_bitstrm->u4_cur_word = 0; \
ps_bitstrm->i4_bits_left_in_cw = WORD_SIZE; \
} \
}


/*****************************************************************************/
Expand Down
6 changes: 6 additions & 0 deletions encoder/ih264e_encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,12 @@ WORD32 ih264e_encode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op)

ih264_list_reset(ps_codec->pv_entropy_jobq);

error_status = ih264e_update_rc_post_enc(ps_codec, ctxt_sel, (ps_codec->i4_poc == 0));
SET_ERROR_ON_RETURN(error_status,
((error_status == IH264E_BITSTREAM_BUFFER_OVERFLOW) ?
IVE_UNSUPPORTEDPARAM : IVE_FATALERROR),
ps_video_encode_op->s_ive_op.u4_error_code, IV_FAIL);

if (ps_codec->s_cfg.u4_enable_quality_metrics & QUALITY_MASK_PSNR)
{
ih264e_compute_quality_stats(ps_proc);
Expand Down
2 changes: 1 addition & 1 deletion encoder/ih264e_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
{\
out_status = ((1 << severity) | error);\
ps_codec->i4_error_code = out_status;\
return (ret_code);\
if (severity == IVE_FATALERROR) return (ret_code);\
}


Expand Down
6 changes: 0 additions & 6 deletions encoder/ih264e_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -2621,12 +2621,6 @@ WORD32 ih264e_process_thread(void *pv_proc)
/* entropy code all mbs enlisted under the current job */
error_status = ih264e_entropy(ps_proc);

if (s_job.i2_mb_y == ps_proc->i4_ht_mbs - 1)
{
error_status |= ih264e_update_rc_post_enc(ps_codec, ctxt_sel,
(ps_codec->i4_poc == 0));
}

/* Dont execute any further instructions until store synchronization took place */
DATA_SYNC();

Expand Down