📄 tarith_decoder_jpeg2000.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 : tarith_decoder_JPEG2000.c
Description : This module tests the arith_decoder_JPEG2000() function.
*******************************************************************************/
#include <stdio.h>
#include"tarith_decoder_JPEG2000.h"
#include "test_input.h"
int error_flag = 0;
void (*f1)();
int cycle_count[MAX_PAIR+1];
void _arith_decode_init();
void _arith_decoder_JPEG2000();
void main()
{
int i,j,k;
unsigned char D,cx;
int error;
// test case : 1
for (i = 0; i <= MAX_CONTEXTS; i++)
{
contexts[i].I = zero_in;
contexts[i].MPS = zero_in;
// load Index value and MPS to each context
}
contexts[UNIFORM_CX].I = uniform_index;
contexts[RUNLENGTH_CX].I = runlen_index;
contexts[0].I = zero_index;
f1 = _arith_decode_init;
cycle_count[0] = Compute_Cycle_Count(&dec_reg,&arrayIn1_CD[0],&arrayOut[0]);
//This function inturn calls arith_decode_init()
// call arith_init to initialize the encoder
f1 = _arith_decoder_JPEG2000;
for (i=0;i<MAX_PAIR;i++)
{
cx = arrayIn1_C[i]; // get context and decision value
// _arith_decoder_JPEG2000(cx,&dec_reg,&mqstates[0],&contexts[0]);
cycle_count[i+1] = Compute_Cycle_Count(cx,&dec_reg,&mqstates[0],
&contexts[0]);
//This function inturn calls arith_decoder_JPEG2000()
}
for(i=0;i<MAX_PAIR;i++)
{
error=arrayOut[i]-exp_output1[i];
if(abs(error) > MAX_PERMISSIBLE_ERROR)
{
error_flag = error_flag | 1;
break;
}
}
// test2
for (i = 0; i <= MAX_CONTEXTS; i++)
{
contexts[i].I = zero_in;
contexts[i].MPS = zero_in; // load Index value and MPS to each context
}
contexts[UNIFORM_CX].I = uniform_index;
contexts[RUNLENGTH_CX].I=runlen_index;
contexts[0].I = zero_index;
f1 = _arith_decode_init;
_arith_decode_init(&dec_reg,&arrayIn2_CD[0],&arrayOut[0]);
f1 = _arith_decoder_JPEG2000;
for (i=0;i<MAX_PAIR;i++)
{
cx = arrayIn2_C[i]; // get context and decision value
_arith_decoder_JPEG2000(cx,&dec_reg,&mqstates[0],&contexts[0]);
}
for(i=0;i<MAX_PAIR;i++)
{
error=arrayOut[i]-exp_output2[i];
if(abs(error) >MAX_PERMISSIBLE_ERROR)
{
error_flag = error_flag | 2;
break;
}
}
// test 3
for (i = 0; i <= MAX_CONTEXTS; i++)
{
contexts[i].I = zero_in;
contexts[i].MPS = zero_in; // load Index value and MPS to each context
}
contexts[UNIFORM_CX].I = uniform_index;
contexts[RUNLENGTH_CX].I=runlen_index;
contexts[0].I = zero_index;
f1 = _arith_decode_init;
_arith_decode_init(&dec_reg,&arrayIn3_CD[0],&arrayOut[0]);
f1 = _arith_decoder_JPEG2000;
for (i=0;i<MAX_PAIR;i++)
{
cx = arrayIn3_C[i]; // get context and decision value
_arith_decoder_JPEG2000(cx,&dec_reg,&mqstates[0],&contexts[0]);
}
for(i=0;i<MAX_PAIR;i++)
{
error=arrayOut[i]-exp_output3[i];
if(abs(error) > MAX_PERMISSIBLE_ERROR)
{
error_flag = error_flag | 4;
break;
}
}
#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");
#endif
printf("cycle_count[0]=%d,cycle_count[1]=%d,cycle_count[2]=%d\n",cycle_count[0],cycle_count[1],cycle_count[2]);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -