⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_full_search_mpeg2.c

📁 用于DSP的MPEG2的全搜索汇编代码
💻 C
字号:
/*******************************************************************************
Copyright(c) 2000 - 2002 Analog Devices. All Rights Reserved.
Developed by Joint Development Software Application Team, IPDC, Bangalore, India
for Blackfin DSPs  ( Micro Signal Architecture 1.0 specification).

By using this module you agree to the terms of the Analog Devices License
Agreement for DSP Software. 
********************************************************************************
File name   : test_full_search_mpeg2.c
Description : This is the test file for the testing of functionality of
              of full_search_mpeg2.
*******************************************************************************/
#include <stdio.h>
#include "results.h"

extern void _full_search_mpeg2(unsigned char *, unsigned char *, signed char *,
                               signed char *, int, int, int);

int error_flag = 0;
void (*f1)();
int cycle_count[10];

void _full_search_mpeg2();

main()
{
    char *exp_u, *exp_v;
    int i, j, m = ROWS, n = COLUMNS, BM = ROWS/16, BN = COLUMNS/16, diff;
    int search_factor;

    f1 = _full_search_mpeg2;
    
    /* Search_factor = 1, 2, or 3 */
    search_factor = 2;

    if (search_factor == 1)
    {
        exp_u = exp_mu_1;
        exp_v = exp_mv_1;
    }
    else if (search_factor == 2)
    {
        exp_u = exp_mu_2;
        exp_v = exp_mv_2;
    }
    else if (search_factor == 3)
    {
        exp_u = exp_mu_3;
        exp_v = exp_mv_3;
    }
    else
    {
        error_flag = error_flag | 0xffff;
    }

//Test case 1

    for(i = 0;i < ROWS; i++)
    {
        for(j = 0;j < COLUMNS; j++)
        {
            target[i*COLUMNS+j] = 100;
            reference[i*COLUMNS+j] = 0;
        }
    }
    for(i = VER;i < VER + 16; i++)
    {   
        for(j = HOR;j < HOR + 16; j++)
        {
            reference[i*COLUMNS+j] = 80;
            reference[(i+16)*COLUMNS+(j-16)] = 80;
            reference[(i+32)*COLUMNS+(j+32)] = 80;
            reference[(i+48)*COLUMNS+j] = 80;
            reference[(i+64)*COLUMNS+(j-16)] = 80;
        }
    }

    _full_search_mpeg2(target, reference, mu, mv, m, n, search_factor);

    for(i = 0; i<BM ; i++)
    {
        for(j = 0; j<BN ; j++)
        {   
            diff = mu[i*BN+j] - *(exp_u+i*BN+j);
            if (diff != 0)
            {
                error_flag = error_flag | 1;
            }

            diff = mv[i*BN+j] - *(exp_v+i*BN+j);
            if (diff != 0)
            {
                error_flag = error_flag | 1;
            }

        }
        
    }

    #ifdef PRINTF_SUPPORT
        if(error_flag & 1)
            printf("Test Case 1 failed\n");
        else
            printf("Test Case 1 passed\n");
    #endif

// Test case for finding cycle count

    search_factor = 1;

    for(i = 0;i < ROWS; i++)
    {
        for(j = 0;j < COLUMNS; j++)
        {
            target[i*COLUMNS+j] = 100;
            reference[i*COLUMNS+j] = 3*i+12*j;
        }
    }
    for(i = 0;i < 16; i++)
    {   
        for(j = 32;j < 48; j++)
            reference[i*COLUMNS+j] = 80;
    }

    cycle_count[0] = Compute_Cycle_Count(target, reference, mu, mv, m, n,
                                    search_factor);
                            //This function inturn calls full_search_mpeg2()
    printf("cycle_count[0]=%d\n",cycle_count[0]);
                            
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -