Skip to content

Commit

Permalink
Fix shifting negative value warning (#457)
Browse files Browse the repository at this point in the history
* Fix shifting negative value warning

* Fix shifting negative value warning
  • Loading branch information
Jamaika1 authored Nov 1, 2024
1 parent 9075708 commit f1091cd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
22 changes: 11 additions & 11 deletions source/Lib/CommonLib/InterpolationFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,12 @@ void InterpolationFilter::filter(const ClpRng& clpRng, Pel const *src, int srcSt
{
shift += (isFirst) ? 0 : headRoom;
offset = 1 << (shift - 1);
offset += (isFirst) ? 0 : IF_INTERNAL_OFFS << IF_FILTER_PREC;
offset += (isFirst) ? 0 : (IF_INTERNAL_OFFS << IF_FILTER_PREC);
}
else
{
shift -= (isFirst) ? headRoom : 0;
offset = (isFirst) ? -IF_INTERNAL_OFFS *(1<<shift) : 0;
offset = (isFirst) ? -(IF_INTERNAL_OFFS << shift) : 0;
}
}
else
Expand Down Expand Up @@ -784,14 +784,14 @@ void InterpolationFilter::filterXxY_N2( const ClpRng& clpRng, Pel const *src, in
{
shift1st -= headRoom;
shift2nd += headRoom;
offset1st = -IF_INTERNAL_OFFS << shift1st;
offset1st = -(IF_INTERNAL_OFFS << shift1st);
offset2nd = 1 << ( shift2nd - 1 );
offset2nd += IF_INTERNAL_OFFS << IF_FILTER_PREC;
offset2nd += (IF_INTERNAL_OFFS << IF_FILTER_PREC);
}
else
{
shift1st -= headRoom;
offset1st = -IF_INTERNAL_OFFS << shift1st;
offset1st = -(IF_INTERNAL_OFFS << shift1st);
offset2nd = 0;
}

Expand Down Expand Up @@ -853,14 +853,14 @@ void InterpolationFilter::filterXxY_N4( const ClpRng& clpRng, const Pel* src, in
{
shift1st -= headRoom;
shift2nd += headRoom;
offset1st = -IF_INTERNAL_OFFS *(1<< shift1st);
offset1st = -(IF_INTERNAL_OFFS << shift1st);
offset2nd = 1 << ( shift2nd - 1 );
offset2nd += IF_INTERNAL_OFFS << IF_FILTER_PREC;
offset2nd += (IF_INTERNAL_OFFS << IF_FILTER_PREC);
}
else
{
shift1st -= headRoom;
offset1st = -IF_INTERNAL_OFFS *(1<< shift1st);
offset1st = -(IF_INTERNAL_OFFS << shift1st);
offset2nd = 0;
}

Expand Down Expand Up @@ -933,14 +933,14 @@ void InterpolationFilter::filterXxY_N8( const ClpRng& clpRng, const Pel* src, in
{
shift1st -= headRoom;
shift2nd += headRoom;
offset1st = -IF_INTERNAL_OFFS *(1<< shift1st);
offset1st = -(IF_INTERNAL_OFFS << shift1st);
offset2nd = 1 << ( shift2nd - 1 );
offset2nd += IF_INTERNAL_OFFS << IF_FILTER_PREC;
offset2nd += (IF_INTERNAL_OFFS << IF_FILTER_PREC);
}
else
{
shift1st -= headRoom;
offset1st = -IF_INTERNAL_OFFS *(1<< shift1st);
offset1st = -(IF_INTERNAL_OFFS << shift1st);
offset2nd = 0;
}

Expand Down
26 changes: 13 additions & 13 deletions source/Lib/CommonLib/x86/InterpolationFilterX86.h
Original file line number Diff line number Diff line change
Expand Up @@ -1500,12 +1500,12 @@ static void simdFilter( const ClpRng& clpRng, Pel const *src, int srcStride, Pel
{
shift += ( isFirst ) ? 0 : headRoom;
offset = 1 << ( shift - 1 );
offset += ( isFirst ) ? 0 : IF_INTERNAL_OFFS << IF_FILTER_PREC;
offset += ( isFirst ) ? 0 : (IF_INTERNAL_OFFS << IF_FILTER_PREC);
}
else
{
shift -= ( isFirst ) ? headRoom : 0;
offset = ( isFirst ) ? -IF_INTERNAL_OFFS * (1<< shift) : 0;
offset = ( isFirst ) ? -(IF_INTERNAL_OFFS << shift) : 0;
}
}
else
Expand Down Expand Up @@ -1688,14 +1688,14 @@ void simdFilter4x4_N6( const ClpRng& clpRng, Pel const *src, int srcStride, Pel*
{
shift1st -= headRoom;
shift2nd += headRoom;
offset1st = -IF_INTERNAL_OFFS *(1<< shift1st);
offset1st = -(IF_INTERNAL_OFFS << shift1st);
offset2nd = 1 << ( shift2nd - 1 );
offset2nd += IF_INTERNAL_OFFS << IF_FILTER_PREC;
offset2nd += (IF_INTERNAL_OFFS << IF_FILTER_PREC);
}
else
{
shift1st -= headRoom;
offset1st = -IF_INTERNAL_OFFS *(1<< shift1st);
offset1st = -(IF_INTERNAL_OFFS << shift1st);
offset2nd = 0;
}

Expand Down Expand Up @@ -2221,13 +2221,13 @@ void simdFilter16xX_N8( const ClpRng& clpRng, Pel const *src, int srcStride, Pel
// negative for bit depths greater than 14, shift will remain non-negative for bit depths of 8->20

shift1st -= headRoom;
offset1st = -IF_INTERNAL_OFFS *(1<< shift1st);
offset1st = -(IF_INTERNAL_OFFS << shift1st);

if( isLast )
{
shift2nd += headRoom;
offset2nd = 1 << ( shift2nd - 1 );
offset2nd += IF_INTERNAL_OFFS << IF_FILTER_PREC;
offset2nd += (IF_INTERNAL_OFFS << IF_FILTER_PREC);
}
else
{
Expand Down Expand Up @@ -2490,13 +2490,13 @@ void simdFilter16xX_N4( const ClpRng& clpRng, Pel const *src, int srcStride, Pel
// negative for bit depths greater than 14, shift will remain non-negative for bit depths of 8->20

shift1st -= headRoom;
offset1st = -IF_INTERNAL_OFFS *(1<< shift1st);
offset1st = -(IF_INTERNAL_OFFS << shift1st);

if( isLast )
{
shift2nd += headRoom;
offset2nd = 1 << ( shift2nd - 1 );
offset2nd += IF_INTERNAL_OFFS << IF_FILTER_PREC;
offset2nd += (IF_INTERNAL_OFFS << IF_FILTER_PREC);
}
else
{
Expand Down Expand Up @@ -2537,13 +2537,13 @@ void simdFilter8xX_N8( const ClpRng& clpRng, Pel const *src, int srcStride, Pel*
// negative for bit depths greater than 14, shift will remain non-negative for bit depths of 8->20

shift1st -= headRoom;
offset1st = -IF_INTERNAL_OFFS * (1<< shift1st);
offset1st = -(IF_INTERNAL_OFFS << shift1st);

if( isLast )
{
shift2nd += headRoom;
offset2nd = 1 << ( shift2nd - 1 );
offset2nd += IF_INTERNAL_OFFS << IF_FILTER_PREC;
offset2nd += (IF_INTERNAL_OFFS << IF_FILTER_PREC);
}
else
{
Expand Down Expand Up @@ -2774,13 +2774,13 @@ void simdFilter8xX_N4( const ClpRng& clpRng, Pel const *src, int srcStride, Pel*
// negative for bit depths greater than 14, shift will remain non-negative for bit depths of 8->20

shift1st -= headRoom;
offset1st = -IF_INTERNAL_OFFS *(1<< shift1st);
offset1st = -(IF_INTERNAL_OFFS << shift1st);

if( isLast )
{
shift2nd += headRoom;
offset2nd = 1 << ( shift2nd - 1 );
offset2nd += IF_INTERNAL_OFFS << IF_FILTER_PREC;
offset2nd += (IF_INTERNAL_OFFS << IF_FILTER_PREC);
}
else
{
Expand Down

0 comments on commit f1091cd

Please sign in to comment.