Skip to content

Commit 3b2c1f0

Browse files
authored
Fix valgrind false positive (#392)
1 parent ca7e28c commit 3b2c1f0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

source/Lib/CommonLib/x86/DepQuantX86.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,6 @@ namespace DQIntern
734734
//{
735735
// rdCostZ = decisionA.rdCost;
736736
//}
737-
738737
__m128i numSig = _mm_loadu_si32( state.numSig );
739738

740739
rdCostZ01 = _mm_add_epi64( rdCostZ01, _mm_cvtepi32_epi64( sgbts02 ) );
@@ -760,7 +759,6 @@ namespace DQIntern
760759
rdCostZ01 = _mm_blendv_epi8( rdMax, rdCostZ01, mask02 );
761760
rdCostZ23 = _mm_blendv_epi8( rdMax, rdCostZ23, mask13 );
762761
}
763-
764762
// decision 0: either A from 0 (pq0), or B from 1 (pq2), or 0 from 0
765763
// decision 1: either A from 2 (pq3), or B from 3 (pq1), or 0 from 2
766764
// decision 2: either A from 1 (pq0), or B from 0 (pq2), or 0 from 1
@@ -774,8 +772,14 @@ namespace DQIntern
774772
__m128i rdBest23 = rdCostB23;
775773

776774
__m128i valBest = _mm_setr_epi32( 0, 0, pqData[2].absLevel, pqData[1].absLevel );
777-
__m128i valCand = _mm_setr_epi32( pqData[0].absLevel, pqData[3].absLevel, 0, 0 );
778775

776+
#if ENABLE_VALGRIND_CODE
777+
// just to avoid strange "unknown instruction" error
778+
__m128i valCand = _mm_setr_epi32( 0, pqData[3].absLevel, 0, 0 );
779+
valCand = _mm_insert_epi32 (valCand, pqData[0].absLevel,0);
780+
#else
781+
__m128i valCand = _mm_setr_epi32( pqData[0].absLevel, pqData[3].absLevel, 0, 0 );
782+
#endif
779783
__m128i idxBest = _mm_setr_epi32( 0, 2, 0, 2 );
780784
__m128i idxCand = _mm_setr_epi32( 0, 2, 1, 3 );
781785

@@ -1510,4 +1514,4 @@ template void DepQuant::_initDepQuantX86<SIMDX86>();
15101514

15111515
//! \}
15121516

1513-
;
1517+
;

0 commit comments

Comments
 (0)