Technical discussions related to Analog Devices DSPs (including Blackfin, TigerSHARC, SHARC and ADSP-21xx DSPs).
Hi,
I am using first time BF-DSP processors.I need some clarification regarding sample code of
JEG-decoder.
1) I am using sample JEG Decoder, which is provided by ADI(arith_decoder_JPEG2000).
2) It contains one .c file &two.asm files.
3) my doubt--> how the output is dumping.i.e in the formatt of RGB or YUV
if it is RGB, is it dumping RGB,RGB,...etc or RRRRR...GGGG...BBBB..etc.
and in that code where (which location) it is dumping?
4) If its RGB formatt I need to convert YUV formatt, agian the YUV is connect to PPI of
BF-561 processor.
I am pasting the code also, pls helpme out.
#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]);
}
Thanks & regards,
Subramanyam