Commit 8f79dcc2 authored by Loren Merritt's avatar Loren Merritt
Browse files

wrong modulus when delta_qp = +26



git-svn-id: svn://svn.videolan.org/x264/trunk@466 df754926-b1dd-0310-bc7b-ec298dee348c
parent 78f414d5
......@@ -369,7 +369,7 @@ static void x264_cabac_mb_qp_delta( x264_t *h, x264_cabac_t *cb )
{
int val = i_dqp <= 0 ? (-2*i_dqp) : (2*i_dqp - 1);
/* dqp is interpreted modulo 52 */
if( val > 52 )
if( val >= 51 && val != 52 )
val = 103 - val;
while( val-- )
{
......
......@@ -259,11 +259,12 @@ static void cavlc_qp_delta( x264_t *h, bs_t *s )
int i_dqp = h->mb.i_qp - h->mb.i_last_qp;
if( i_dqp )
{
i_dqp = i_dqp <= 0 ? (-2*i_dqp) : (2*i_dqp - 1);
if( i_dqp > 52 )
i_dqp = 103 - i_dqp;
if( i_dqp < -26 )
i_dqp += 52;
else if( i_dqp > 25 )
i_dqp -= 52;
}
bs_write_ue( s, i_dqp );
bs_write_se( s, i_dqp );
}
static void x264_sub_mb_mv_write_cavlc( x264_t *h, bs_t *s, int i_list )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment