Вы находитесь на странице: 1из 17

Intel IPP Samples for Windows -

:
: 27.01.2011
, PVS-Studio .
, . ,
IPP 7.0 (Intel Performance Primitives Library).
Intel Parallel Studio 2011 Performance Primitives Library.
,
, , ,
- . , .
Intel ,
.
:

Code Samples for the Intel Integrated Performance Primitives (Intel IPP) Library

Intel Integrated Performance Primitives Library 7.0 Samples for Parallel Studio 2011

IPP Samples for Windows

IPP UIC Demo for Windows

IPP DMIP Samples for Windows

IPP Cryptography Samples for Windows

,
IPP Samples for Windows. , PVSStudio 4.10.
,
. "
" .
.
IPP .
, IPP Samples for Windows . ,
1.6 ,
. .


"
Copy-Paste ++ ":
struct AVS_MB_INFO
{
...
Ipp8u refIdx[AVS_DIRECTIONS][4];
...
};

void AVSCompressor::GetRefIndiciesBSlice(void){
...
if (m_pMbInfo->predType[0] & predType)
{
m_refIdx[iRefNum] = m_pMbInfo->refIdx[dir][0];
iRefNum += 1;
}
if (m_pMbInfo->predType[1] & predType)
{
m_refIdx[iRefNum] = m_pMbInfo->refIdx[dir][1];
iRefNum += 1;
}
if (m_pMbInfo->predType[2] & predType)
{
m_refIdx[iRefNum] = m_pMbInfo->refIdx[dir][2];
iRefNum += 1;
}
if (m_pMbInfo->predType[3] & predType)
{
m_refIdx[iRefNum] = m_pMbInfo->refIdx[dir][30];

iRefNum += 1;
}
...
}
PVS-Studio: V557 Array overrun is possible. The '30' index is pointing
beyond array bound. avs_enc umc_avs_enc_compressor_enc_b.cpp 495
.
. 3, 0.
30 .


, :
AACStatus aacencGetFrame(...)
{
...
if (maxEn[0] > maxEn[1]) {
ics[1].num_window_groups = ics[0].num_window_groups;
for (g = 0; g < ics[0].num_window_groups; g++) {
ics[1].len_window_group[g] = ics[0].len_window_group[g];
}
} else {
ics[1].num_window_groups = ics[0].num_window_groups;
for (g = 0; g < ics[0].num_window_groups; g++) {
ics[1].len_window_group[g] = ics[0].len_window_group[g];
}
}
...
}
PVS-Studio: V523 The 'then' statement is equivalent to the 'else'
statement. aac_enc aac_enc_api_fp.c 1379
, , .
"if" .

"--"
"*"
static void
sbrencConflictResolution (..., Ipp32s *nLeftBord)
{
...
*nLeftBord = nBordNext - 1;
...
if (*lenBordNext > 1) {
...
*nLeftBord--;
}
...
}
PVS-Studio: V532 Consider inspecting the statement of '*pointer--'
pattern. Probably meant: '(*pointer)--'. aac_enc sbr_enc_frame_gen.c 428
"nLeftBord" "sbrencConflictResolution".
"nBordNext - 1".
.
:
*nLeftBord--;
, .
:
(*nLeftBord)--;

"++"
"*"
. , ,
. , - .
static IppStatus mp2_HuffmanTableInitAlloc(Ipp32s *tbl, ...)
{
...
for (i = 0; i < num_tbl; i++) {

*tbl++;
}
...
}
PVS-Studio: V532 Consider inspecting the statement of '*pointer++'
pattern. Probably meant: '(*pointer)++'. mpeg2_dec umc_mpeg2_dec.cpp 59
, , :
tbl += num_tbl;
PVS-Studio , ,,
"(*tbl)++;". . :
*tbl += num_tbl;
, - . , , ,
.

,
"GetTrackByPidOrCreateNew", "-1" ,
.
typedef signed int

Ipp32s;

typedef unsigned int

Ipp32u;

Ipp32s StreamParser::GetTrackByPidOrCreateNew(
Ipp32s iPid, bool *pIsNew)
{
...
else if (!pIsNew || m_uiTracks >= MAX_TRACK)
return -1;
...
}
"GetTrackByPidOrCreateNew" .
:
Status StreamParser::GetNextData(MediaData *pData, Ipp32u *pTrack)
{

...
*pTrack = GetTrackByPidOrCreateNew(m_pPacket->iPid, NULL);

if (*pTrack >= 0 && TRACK_LPCM == m_pInfo[*pTrack]->m_Type)


ippsSwapBytes_16u_I((Ipp16u *)pData->GetDataPointer(),
m_pPacket->uiSize / 2);
...
}
PVS-Studio: V547 Expression '* pTrack >= 0' is always true. Unsigned type
value is always >= 0. demuxer umc_stream_parser.cpp 179
, "GetTrackByPidOrCreateNew"
(unsigned int). , "-1" "4294967295", "*pTrack >= 0"
.
, "GetTrackByPidOrCreateNew " "-1", Access
Violation "m_pInfo[*pTrack]->m_Type".

Copy-Paste +1
void H264SegmentDecoder::ResetDeblockingVariablesMBAFF()
{
...
if (GetMBFieldDecodingFlag(m_gmbinfo->mbs[m_CurMBAddr
- mb_width * 2]))
m_deblockingParams.nNeighbour[HORIZONTAL_DEBLOCKING] =
m_CurMBAddr - mb_width * 2;
else
m_deblockingParams.nNeighbour[HORIZONTAL_DEBLOCKING] =
m_CurMBAddr - mb_width * 2;
...
}
PVS-Studio: V523 The 'then' statement is equivalent to the 'else'
statement. h264_dec umc_h264_segment_decoder_deblocking_mbaff.cpp 340
, ,
. :

if (GetMBFieldDecodingFlag(m_gmbinfo->mbs[m_CurMBAddr
- mb_width * 2]))
m_deblockingParams.nNeighbour[HORIZONTAL_DEBLOCKING] =
m_CurMBAddr - mb_width * 2;
else
m_deblockingParams.nNeighbour[HORIZONTAL_DEBLOCKING] =
m_CurMBAddr - mb_width * 2 + 1;
"H264CoreEncoder_ResetDeblockingVariablesMBAFF"
"+ 1".
PVS-Studio: V523 The 'then' statement is equivalent to the 'else'
statement. h264_enc umc_h264_deblocking_mbaff_tmpl.cpp.h 366

Remove,
void H264ThreadGroup::RemoveThread(H264Thread * thread)
{
AutomaticUMCMutex guard(m_mGuard);
std::remove(m_threads.begin(), m_threads.end(), thread);
}
PVS-Studio: V530 The return value of function 'remove' is required to be
utilized. h264_dec umc_h264_thread.cpp 226
. , . mutex,
. , ,
std::remove , .
:
m_threads .erase(
std::remove(m_threads.begin(), m_threads.end(), thread),
m_threads.end());


, H264 -
. . ,
, -
.
bool H264_AU_Stream::IsPictureSame(H264SliceHeaderParse & p_newHeader)

{
if ((p_newHeader.frame_num != m_lastSlice.frame_num) ||
(p_newHeader.pic_parameter_set_id !=
p_newHeader.pic_parameter_set_id) ||
(p_newHeader.field_pic_flag != p_newHeader.field_pic_flag) ||
(p_newHeader.bottom_field_flag != m_lastSlice.bottom_field_flag)
){
return false;
}
...
}
PVS-Studio:
V501 There are identical sub-expressions 'p_newHeader.pic_parameter_set_id' to the left and to the
right of the '!=' operator. h264_spl umc_h264_au_stream.cpp 478
V501 There are identical sub-expressions 'p_newHeader.field_pic_flag' to the left and to the right of the
'!=' operator. h264_spl umc_h264_au_stream.cpp 479

, .
:
(p_newHeader.pic_parameter_set_id != m_lastSlice.pic_parameter_set_id)
(p_newHeader.field_pic_flag != m_lastSlice.field_pic_flag)


, ,
:
Ipp32s ippVideoEncoderMPEG4::Init(mp4_Param *par)
{
...
VOL.sprite_width = par->sprite_width;
VOL.sprite_height = par->sprite_height;
VOL.sprite_left_coordinate = par->sprite_left_coordinate;
VOL.sprite_top_coordinate = par->sprite_left_coordinate;

...
}
PVS-Studio: V537 Consider reviewing the correctness of
'sprite_left_coordinate' item's usage. mpeg4_enc mp4_enc_misc.cpp 387
"VOL.sprite_top_coordinate" .
:
VOL.sprite_top_coordinate = par->sprite_top_coordinate;


JERRCODE CJPEGDecoder::DecodeScanBaselineNI(void)
{
...
for(c = 0; c < m_scan_ncomps; c++)
{
block = m_block_buffer + (DCTSIZE2*m_nblock*(j+(i*m_numxMCU)));

// skip any relevant components


for(c = 0; c < m_ccomp[m_curr_comp_no].m_comp_no; c++)
{
block += (DCTSIZE2*m_ccomp[c].m_nblocks);
}
...
}
PVS-Studio: V535 The variable 'c' is being used for this loop and for the
outer loop. jpegcodec jpegdec.cpp 4652
, , 'c'.
.


H264EncoderFrameType*
H264ENC_MAKE_NAME(H264EncoderFrameList_findOldestToEncode)(...)
{
...

MaxBrefPOC =
H264ENC_MAKE_NAME(H264EncoderFrame_PicOrderCnt)(pCurr, 0, 3);
MaxBrefPOC =
H264ENC_MAKE_NAME(H264EncoderFrame_PicOrderCnt)(pCurr, 0, 3);
...
}
PVS-Studio: V519 The 'MaxBrefPOC' object is assigned values twice
successively. Perhaps this is a mistake. h264_enc umc_h264_enc_cpb_tmpl.cpp.h 784
, :
- GOTO ?
- !
, , , - .

,
AACStatus sbrencResampler_v2_32f(Ipp32f* pSrc, Ipp32f* pDst)
{
...
k = nCoef-1;
k = nCoef;
...
}
PVS-Studio: V519 The 'k' object is assigned values twice successively.
Perhaps this is a mistake. aac_enc sbr_enc_resampler_fp.c 90
, .
, . , , "nCoef-1",
"nCoef". " ".
, ,
.

,
void MeBase::MakeVlcTableDecision()
{
...

Ipp32s BestMV= IPP_MIN(IPP_MIN(m_cur.MvRate[0],m_cur.MvRate[1]),


IPP_MIN(m_cur.MvRate[2],m_cur.MvRate[3]));
Ipp32s BestAC= IPP_MIN(IPP_MIN(m_cur.AcRate[0],m_cur.AcRate[1]),
IPP_MIN(m_cur.AcRate[2],m_cur.AcRate[2]));
...
}
PVS-Studio: V501 There are identical sub-expressions to the left and to
the right of the '<' operator: (m_cur.AcRate [2]) < (m_cur.AcRate [2]) me umc_me.cpp 898
. 3, 2.
:
Ipp32s BestAC= IPP_MIN(IPP_MIN(m_cur.AcRate[0],m_cur.AcRate[1]),
IPP_MIN(m_cur.AcRate[2],m_cur.AcRate[3]));
, " ".
, "m_cur.AcRate[3]".
, .

,
:
Ipp32s ippVideoEncoderMPEG4::Init(mp4_Param *par)
{
...
i = IPP_MAX(mBVOPsearchHorBack, mBVOPsearchHorBack);
...
}
PVS-Studio: V501 There are identical sub-expressions
'(mBVOPsearchHorBack)' to the left and to the right of the '>' operator. mpeg4_enc mp4_enc_misc.cpp
547
mBVOPsearchHorBack.
mBVOPsearchHorBack mBVOPsearchVerBack:
i = IPP_MAX(mBVOPsearchHorBack, mBVOPsearchVerBack);


typedef struct
{
...
VM_ALIGN16_DECL(Ipp32f)
nb_short[2][3][__ALIGNED(MAX_PPT_SHORT)];
...
} mpaPsychoacousticBlock;

static void mp3encPsy_short_window(...)


{
...
if (win_counter == 0) {
nb_s = pBlock->nb_short[0][3];
}
...
}
PVS-Studio: V557 Array overrun is possible. The '3' index is pointing
beyond array bound. mp3_enc mp3enc_psychoacoustic_fp.c 726
. '3' '2'. ,
, .

,
void lNormalizeVector_32f_P3IM(Ipp32f *vec[3], Ipp32s* mask,
Ipp32s len) {
Ipp32s

i;

Ipp32f

norm;

for(i=0; i<len; i++) {


if(mask<0) continue;
norm = 1.0f/sqrt(vec[0][i]*vec[0][i]+
vec[1][i]*vec[1][i]+

vec[2][i]*vec[2][i]);
vec[0][i] *= norm; vec[1][i] *= norm; vec[2][i] *= norm;
}
}
PVS-Studio: V503 This is a nonsensical comparison: pointer < 0.
ipprsample ippr_sample.cpp 501
, - , .
, .
. "if(mask<0)".
"i". "mask"
, ,, .
:
if(mask[i]<0) continue;

0
int ec_fb_GetSubbandNum(void *stat)
{
_fbECState *state=(_fbECState *)stat;
return (state->freq-state->freq);
}
PVS-Studio: V501 There are identical sub-expressions to the left and to
the right of the '-' operator: state->freq - state->freq speech ec_fb.c 250
- 0. -
. , .


typedef unsigned int

Ipp32u;

UMC::Status Init(..., Ipp32u memSize, ...)


{
...
memSize -= UMC::align_value<Ipp32u>(m_nFrames*sizeof(Frame));
if(memSize < 0)
return UMC::UMC_ERR_NOT_ENOUGH_BUFFER;

...
}
PVS-Studio: V547 Expression 'memSize < 0' is always false. Unsigned type
value is never < 0. vc1_enc umc_vc1_enc_planes.h 200
, , .
, .
, "memSize" "unsigned int". , "memSize < 0"
.
, . ,
. ,
10. , .


Ipp32u m_iCurrMBIndex;
VC1EncoderMBInfo* VC1EncoderMBs::GetPevMBInfo(Ipp32s x, Ipp32s y)
{
Ipp32s row = (y>0)? m_iPrevRowIndex:m_iCurrRowIndex;
return ((m_iCurrMBIndex - x <0 || row <0)? 0 :
&m_MBInfo[row][m_iCurrMBIndex - x]);
}
PVS-Studio: V547 Expression 'm_iCurrMBIndex - x < 0' is always false.
Unsigned type value is never < 0. vc1_enc umc_vc1_enc_mb.cpp 188
"m_iCurrMBIndex" "unsigned". - "m_iCurrMBIndex - x"
"unsigned". , "m_iCurrMBIndex - x < 0" .
.
"m_iCurrMBIndex" 5, "x" 10.
"m_iCurrMBIndex - x" 5u - 10i = 0xFFFFFFFBu.
"m_iCurrMBIndex - x < 0" false.
"m_MBInfo[row][0xFFFFFFFBu]" .

'?:'.
, . ,
.
++ .
vm_file* vm_file_fopen(...)

{
...
mds[3] = FILE_ATTRIBUTE_NORMAL |
(islog == 0) ? 0 : FILE_FLAG_NO_BUFFERING;
...
}
PVS-Studio: V502 Perhaps the '?:' operator works in a different way than
it was expected. The '?:' operator has a lower priority than the '|' operator. vm vm_file_win.c 393
FILE_ATTRIBUTE_NORMAL
FILE_FLAG_NO_BUFFERING. "mds[3]" 0.
, "|" , "?:".
, ( ):
(FILE_ATTRIBUTE_NORMAL | (islog == 0)) ?
0 : FILE_FLAG_NO_BUFFERING;
"FILE_ATTRIBUTE_NORMAL | (islog == 0)"
"mds[3]" 0.
( ):
FILE_ATTRIBUTE_NORMAL |
((islog == 0) ? 0 : FILE_FLAG_NO_BUFFERING);


AACStatus alsdecGetFrame(...)
{
...
for (i = 0; i < num; i++) {
...
*tmpPtr = (Ipp32s)((tmp << 24) + ((tmp & 0xff00) << 8) +
((tmp >> 8) & 0xff00) + (tmp >> 24));
*tmpPtr = *srcPrt;
...
}
...

}
PVS-Studio: V519 The '* tmpPtr' object is assigned values twice
successively. Perhaps this is a mistake. aac_dec als_dec_api.c 928
.
- "".


static
IPLStatus ownRemap8u_Pixel(...) {
...
saveXMask

= xMap->maskROI;

saveXMask

= NULL;

saveYMask

= yMap->maskROI;

saveYMask

= NULL;

...
}
PVS-Studio:
V519 The 'saveXMask' object is assigned values twice successively. Perhaps this is a mistake. ipl
iplremap.c 36
V519 The 'saveYMask' object is assigned values twice successively. Perhaps this is a mistake. ipl
iplremap.c 38
.
8 !
:
Ipp32s ippVideoEncoderMPEG4::Init(mp4_Param *par)
{
...
mNumOfFrames = par->NumOfFrames;
mNumOfFrames = -1;
...
}

PVS-Studio: V519 The 'mNumOfFrames' object is assigned values twice


successively. Perhaps this is a mistake. mpeg4_enc mp4_enc_misc.cpp 276

, IPP Samples for Windows.


, - ,
, .
. assert(), -
. , ,
. , ,
.
, .
, , Copy-Paste . ,
,
" " .
C/C++/C++0x . ,
.

Вам также может понравиться