This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

dm6446 DSP端4个for循环嵌套如何优化



下面一段程序是4个for循环嵌套,在DSP端运行后卡住了,不知如何优化?求指导,谢谢!

for( i = 0; i < cascade->count; i++ )

    {

        CvHaarStageClassifier* stage_classifier = cascade->stage_classifier + i;

        if( !stage_classifier->classifier ||

            stage_classifier->count <= 0 )

        {

            sprintf( errorstr, "header of the stage classifier #%d is invalid "

                     "(has null pointers or non-positive classfier count)", i );

            CV_ERROR( CV_StsError, errorstr );

        }

        max_count = MAX( max_count, stage_classifier->count );

        total_classifiers += stage_classifier->count;

        for( j = 0; j < stage_classifier->count; j++ )

        {

            CvHaarClassifier* classifier = stage_classifier->classifier + j;

            total_nodes += classifier->count;

            for( l = 0; l < classifier->count; l++ )

            {

                for( k = 0; k < CV_HAAR_FEATURE_MAX; k++ )

                {

                    if( classifier->haar_feature[l].rect[k].r.width )

                    {

                        CvRect r = classifier->haar_feature[l].rect[k].r;

                        int tilted = classifier->haar_feature[l].tilted;

                        has_tilted_features |= tilted != 0;

                        if( r.width < 0 || r.height < 0 || r.y < 0 ||

                            r.x + r.width > orig_window_size.width

                            ||

                            (!tilted &&

                            (r.x < 0 || r.y + r.height > orig_window_size.height))

                            ||

                            (tilted && (r.x - r.height < 0 ||

                            r.y + r.width + r.height > orig_window_size.height)))

                        {

                            sprintf( errorstr, "rectangle #%d of the classifier #%d of "

                                     "the stage classifier #%d is not inside "

                                     "the reference (original) cascade window", k, j, i );

                            CV_ERROR( CV_StsNullPtr, errorstr );

                        }

                    }

                }

            }

        }

}