网站公告列表

  没有公告

加入收藏
设为首页
联系本站
您现在的位置: Analog安诺电子网 >> 文章 >> 技术交流 >> 文章正文
  Test Arith Encoder MPGE4(C)源代码           ★★★ 【字体:
Test Arith Encoder MPGE4(C)源代码
作者:佚名    文章来源:Internet    点击数:    更新时间:2008-3-26    

/*******************************************************************************
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_arith_encoder_mpeg4.c
Description : This file contains  test cases to validate arithmetic encoder for
              shape coding (MPEG4)
*******************************************************************************/
#include<stdio.h>
#include"bin_ar_code.h"
#include"test_input.h"

int error_flag = 0;
void (*f1)();

void _StartArCoder();
void _arith_encoder_mpeg4();
void _arith_StopArCoder();

void main()
{
    int i,j,k,C,D;
    int error;

    coder=&code;
   
 // test 1;

    _StartArCoder(coder,&bit_output[0]) ;


    for(i=0;i<MAX_PAIR;i++)
    {
        j=arrayIn0_C[i];
        C=intra_prob[j];
        D=arrayIn0_D[i];
 
    _arith_encoder_mpeg4(D,C,coder);
    }

    _arith_StopArCoder(coder);


    for(i=0;i<472;i++)
    {
        error=bit_output[i]-exp_output0[i];
        if(abs(error) >MAX_PERMISSIBLE_ERROR)
        {
            error_flag = error_flag | 1;
        }
   }

// test 2

    _StartArCoder(coder,&bit_output[0]) ;

    for(i=0;i<MAX_PAIR;i++)
    {
        j=arrayIn1_C[i];
        C=intra_prob[j];
        D=arrayIn1_D[i];
      _arith_encoder_mpeg4(D,C,coder);

    }

    _arith_StopArCoder(coder);

    for(i=0;i<1191;i++)
    {
        error=bit_output[i]-exp_output1[i];
        if(abs(error) >MAX_PERMISSIBLE_ERROR)
        {
            error_flag = error_flag | 2;
        }
   }

// test 3
    _StartArCoder(coder,&bit_output[0]) ;

    for(i=0;i<MAX_PAIR;i++)
    {
        j=arrayIn2_C[i];
        C=intra_prob[j];
        D=arrayIn2_D[i];
       _arith_encoder_mpeg4(D,C,coder);
    }

    _arith_StopArCoder(coder);

    for(i=0;i<1197;i++)
    {
        error=bit_output[i]-exp_output2[i];
        if(abs(error) >MAX_PERMISSIBLE_ERROR)
        {
            error_flag = error_flag | 4;
        }
   }

  // test 4
       _StartArCoder(coder,&bit_output[0]) ;

    for(i=0;i<MAX_PAIR;i++)
    {
        j=arrayIn3_C[i];
        C=intra_prob[j];
        D=arrayIn3_D[i];
       _arith_encoder_mpeg4(D,C,coder);
    }

    _arith_StopArCoder(coder);

    for(i=0;i<1069;i++)
    {
        error=bit_output[i]-exp_output3[i];
        if(abs(error) >MAX_PERMISSIBLE_ERROR)
        {
            error_flag = error_flag | 8;
        }
   }
  
 // test 5
    _StartArCoder(coder,&bit_output[0]) ;

    for(i=0;i<MAX_PAIR;i++)
    {
        j=arrayIn4_C[i];
        C=intra_prob[j];
        D=arrayIn3_D[i];
       _arith_encoder_mpeg4(D,C,coder);
    }

    _arith_StopArCoder(coder);

    for(i=0;i<939;i++)
    {
        error=bit_output[i]-exp_output4[i];
        if(abs(error) >MAX_PERMISSIBLE_ERROR)
        {
            error_flag = error_flag | 16;
        }
   }

// test 6
    _StartArCoder(coder,&bit_output[0]) ;

    for(i=0;i<MAX_PAIR;i++)
    {
        j=arrayIn0_C[i];
        C=intra_prob[j];
        D=1;
       _arith_encoder_mpeg4(D,C,coder);
    }

    _arith_StopArCoder(coder);

    for(i=0;i<150;i++)
    {
        error=bit_output[i]-exp_output5[i];
        if(abs(error) >MAX_PERMISSIBLE_ERROR)
        {
            error_flag = error_flag | 32;
        }
    }
    #ifdef PRINTF_SUPPORT
        if(error_flag & 1)
            printf("Test Case 1 failed\n");
        else
            printf("Test Case 1 passed\n");
        if(error_flag & 2)
            printf("Test Case 2 failed\n");
        else
            printf("Test Case 2 passed\n");
        if(error_flag & 4)
            printf("Test Case 3 failed\n");
        else
            printf("Test Case 3 passed\n");
        if(error_flag & 8)
            printf("Test Case 4 failed\n");
        else
            printf("Test Case 4 passed\n");
        if(error_flag & 16)
            printf("Test Case 5 failed\n");
        else
            printf("Test Case 5 passed\n");
        if(error_flag & 32)
            printf("Test Case 6 failed\n");
        else
            printf("Test Case 6 passed\n");
    #endif
}

//本代码Blackfin示例

文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    [连载]TigerSHARC系列DSP概貌
    超声便携式设备的系统划分
    基于ADSP-TS201的实时SAR成像
    binutils-2.18/libiberty/Ma
    bfin-xxx-gcc主控Makefile中
    host-i686-pc-cygwin/gcc/Ma
    bfin-xxx-gcc中native目标的
    bfin-xxx-gcc中collect2目标
    bfin-xxx-gcc中objc目标的生
    [连载]TigerSHARC系列DSP概貌
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    版权所有:Analog安诺电子网 湘ICP备06016315号