LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Sponsors
  • Mirrors
  • Logos
  • Contact us
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Cvs-checkins > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: cvs at opencores.org<cvs@o...>
    Date: Tue Jul 18 04:12:31 CEST 2006
    Subject: [cvs-checkins] MODIFIED: mb-jpeg ...
    Top
    Date: 00/06/07 18:04:12

    Modified: mb-jpeg/encoder dct.c huffman.c io.c main.c zzq.c
    Log:
    Ported to Microblaze processor and XUP2pro board.

    It can read bmp file from CF card, compress, and write back to CF card.

    It can run on borland, gcc/cygwin and microblaze.



    Bug fixed:

    1. in huffman.c/ReverseExtend(), type conversion of 'bits' is wrong.


    Revision Changes Path
    1.2 mb-jpeg/encoder/dct.c

    http://www.opencores.org/cvsweb.shtml/mb-jpeg/encoder/dct.c.diff?r1=1.1&r2=1.2

    (In the diff below, changes in quantity of whitespace are not shown.)

    Index: dct.c
    ===================================================================
    RCS file: /cvsroot/quickwayne/mb-jpeg/encoder/dct.c,v
    retrieving revision 1.1
    retrieving revision 1.2
    diff -u -b -r1.1 -r1.2
    --- dct.c 17 Jul 2006 00:31:42 -0000 1.1
    +++ dct.c 18 Jul 2006 02:12:31 -0000 1.2
    @@ -16,6 +16,8 @@
    Output: dct is the 8x8 output array
    */
    signed int max_val = 0;
    +static int __count=0;
    +
    void dct(signed char pixels[8][8], signed short dct[8][8])
    {
    FILE * file;
    @@ -29,6 +31,25 @@
    // file = fopen("weights.h","w+");
    // fprintf(file,"double weights1[512] = {");
    /* find 1-d dct along rows */
    +#if 0
    +
    +#ifdef __MICROBLAZE
    + if (__count<4) {
    + for (i=0; i<8; i++)
    + for (j=0; j<8; j++)
    + xil_printf("%x ", pixels[i][j]);
    + xil_printf("\r\n");
    + }
    +#else
    + if (__count<4) {
    + for (i=0; i<8; i++)
    + for (j=0; j<8; j++)
    + printf(" %x ", pixels[i][j]);
    + printf("\r\n");
    + }
    +#endif
    +#endif
    +
    for (intr=0; intr<8; intr++)
    for (intc=0; intc<8; intc++) {
    for (i=0,f_val=0; i<8; i++) {
    @@ -58,7 +79,25 @@
    else
    dct[outr][outc] = (11585*(f_val>>14)>>15);
    }
    -
    +#if 0
    +#ifdef __MICROBLAZE
    + if (__count<4) {
    + for (i=0; i<8; i++)
    + for (j=0; j<8; j++)
    + xil_printf("%x ", dct[i][j]);
    + xil_printf("\r\n");
    + __count++;
    + }
    +#else
    + if (__count<4) {
    + for (i=0; i<8; i++)
    + for (j=0; j<8; j++)
    + printf(" %x ", dct[i][j]);
    + printf("\r\n");
    + __count++;
    + }
    +#endif
    +#endif

    }




    1.2 mb-jpeg/encoder/huffman.c

    http://www.opencores.org/cvsweb.shtml/mb-jpeg/encoder/huffman.c.diff?r1=1.1&r2=1.2

    (In the diff below, changes in quantity of whitespace are not shown.)
    Index: huffman.c =================================================================== RCS file: /cvsroot/quickwayne/mb-jpeg/encoder/huffman.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- huffman.c 17 Jul 2006 00:31:42 -0000 1.1 +++ huffman.c 18 Jul 2006 02:12:31 -0000 1.2 @@ -21,13 +21,16 @@ //--------------------------------------------------------------------------- #pragma hdrstop #include <stdio.h> +#ifdef __MICROBLAZE +#include "xup2pro.h" +#endif //=========================================================================== void PrintMatrix(char* pixelmatrix) { int i; - printf("MATRIX= \n"); - for (i=0;i<64;i++) printf("%d |",pixelmatrix[i]); - printf("\n"); +// printf("MATRIX= \n"); +// for (i=0;i<64;i++) printf("%d |",pixelmatrix[i]); +// printf("\n"); } //=========================================================================== void FillMatrix( char* pixelmatrix,int select) @@ -261,7 +264,9 @@ case 0xF8 : *lenght=0x10; *out=0xFFFC; break; //1111111111111100 case 0xF9 : *lenght=0x10; *out=0xFFFD; break; //1111111111111101 case 0xFA : *lenght=0x10; *out=0xFFFE; break; //1111111111111110 +#ifndef __MICROBLAZE default : printf("WAARDE STAAT NIET IN TABEL!!!!!!!!!!!!!!!!!!!!\n");break; +#endif } // printf("magnitude= %x out= %x lenght= %d \n",magnitude,*out,*lenght); return; @@ -450,7 +455,9 @@ case 0xF8 : *lenght=16; *out=0xFFFC; break; //1111111111111100 case 0xF9 : *lenght=16; *out=0xFFFD; break; //1111111111111101 case 0xFA : *lenght=16; *out=0xFFFE; break; //1111111111111110 +#ifndef __MICROBLAZE default : printf("WAARDE STAAT NIET IN TABEL!!!!!!!!!!!!!!!!!!!!\n");break; +#endif } // printf("magnitude= %x out= %x lenght= %d \n",magnitude,*out,*lenght); return; @@ -484,6 +491,9 @@ // printf("reverseextend magnitude= %d bits= %d",magnitude,bits); return; } + +static int __count3=0; + //=========================================================================== void WriteRawBits16(unsigned char amount_bits, unsigned int bits, unsigned int *remaining,unsigned char *amount_remaining, FILE* file) //*remaining needs bo be more than 8 bits because 8 bits could be added and ther ecould already be up ot 7 bits in *remaining // this function collects bits to send @@ -494,6 +504,22 @@ unsigned int mask; unsigned char send2; int count; + + #ifdef __MICROBLAZE + if (__count3<16) { + xil_printf("%x %x, ", amount_bits, bits); + __count3++; + if ((__count3&0x07)==0) xil_printf("\r\n"); + } +#else + if (__count3<16) { + printf(" %x %x, ", amount_bits, bits); + __count3++; + if ((__count3&0x07)==0) printf("\r\n"); + } +#endif + + mask=0x00; //init mask *remaining=(*remaining<<amount_bits); //shift to make place for the new bits for (count=amount_bits; count>0; count--) mask=(mask<<1)|0x01; //create mask for adding bit @@ -501,21 +527,41 @@ *amount_remaining=*amount_remaining + amount_bits; //change *amount_remaining to the correct new value if (*amount_remaining >= 16) //are there more than 16 bits in buffer, send 16 bits { + +#ifndef __MICROBLAZE if (*amount_remaining >= 32 ) printf("ERROR, more bits to send %d",*amount_remaining); +#endif + send=*remaining>>(*amount_remaining-16); //this value can be send/stored (in art this can be dony by selecting bits) send2=(send & 0xFF00) >>8; +#ifdef __MICROBLAZE + sysace_fwrite(&send2,1,1,file); +#else fwrite(&send2,1,1,file); +#endif if (send2==0xFF) { send2=0x00; +#ifdef __MICROBLAZE + sysace_fwrite(&send2,1,1,file); +#else fwrite(&send2,1,1,file); +#endif } send2=send & 0xFF; +#ifdef __MICROBLAZE + sysace_fwrite(&send2,1,1,file); +#else fwrite(&send2,1,1,file); +#endif if (send2==0xFF) { send2=0x00; +#ifdef __MICROBLAZE + sysace_fwrite(&send2,1,1,file); +#else fwrite(&send2,1,1,file); +#endif } *amount_remaining=*amount_remaining-16; //descrease by 16 because these are send } @@ -531,14 +577,22 @@ unsigned int mask; int count; mask=0x00; //init mask - if (*amount_remaining >= 8) //2 bytes to send, send first byte + if (*amount_remaining >= 8) // //2 bytes to send, send first byte { send=*remaining>>(*amount_remaining-8); //shift so that first byte is ready to send +#ifdef __MICROBLAZE + sysace_fwrite(&send,1,1,file); +#else fwrite(&send,1,1,file); +#endif if (send==0xFF) //is this still needed???? { send=0x00; +#ifdef __MICROBLAZE + sysace_fwrite(&send,1,1,file); +#else fwrite(&send,1,1,file); + #endif } *amount_remaining=*amount_remaining -8; // lower the value to the amount of bits that still needs to be send } @@ -548,7 +602,11 @@ mask=0x00; //init mask for (count=(8-*amount_remaining); count>0; count--) mask=(mask<<1)|0x01; //create mask to fill byte up with ones send=send | mask; //add the ones to the byte +#ifdef __MICROBLAZE + sysace_fwrite(&send,1,1,file); +#else fwrite(&send,1,1,file); +#endif *amount_remaining=0x00; //is this needed? } return; @@ -581,11 +639,13 @@ char difference; unsigned char magnitude,zerorun,ii,ert; unsigned int bits; + unsigned char bits_char; //init // PrintMatrix(dataunit) ; difference = dataunit[0] - last_dc_value; last_dc_value=dataunit[0]; - ReverseExtend(difference, &magnitude,&bits); + ReverseExtend(difference, &magnitude,&bits_char); + bits=bits_char; HuffmanEncodeUsingDCTable(magnitude,remaining,amount_remaining, file); WriteRawBits16(magnitude,bits,remaining,amount_remaining, file); zerorun=0; @@ -600,7 +660,8 @@ zerorun=zerorun-16; // printf("16 zeros: %d\n",zerorun); } - ReverseExtend(dataunit[ii],&magnitude,&bits); + ReverseExtend(dataunit[ii],&magnitude,&bits_char); + bits=bits_char; ert= ((int)zerorun *16); //ERROR !!!!!!!!!!! ert=ert + magnitude; HuffmanEncodeUsingACTable(ert,remaining,amount_remaining,file); @@ -618,6 +679,8 @@ // HuffmanEncodeFinishSend(remaining,amount_remaining,file); return last_dc_value; } + +#if 0 //=========================================================================== void DecodeDataUnit(char *coefficients[64], char last_dc_value, char value) { @@ -650,6 +713,6 @@ } } //=========================================================================== - +#endif 1.3 mb-jpeg/encoder/io.c http://www.opencores.org/cvsweb.shtml/mb-jpeg/encoder/io.c.diff?r1=1.2&r2=1.3 (In the diff below, changes in quantity of whitespace are not shown.) Index: io.c =================================================================== RCS file: /cvsroot/quickwayne/mb-jpeg/encoder/io.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- io.c 17 Jul 2006 00:33:49 -0000 1.2 +++ io.c 18 Jul 2006 02:12:31 -0000 1.3 @@ -1,5 +1,9 @@ //--------------------------------------------------------------------------- #include <stdio.h> +#ifdef __MICROBLAZE +#include "xup2pro.h" +#endif + #include "io.h" #pragma hdrstop //--------------------------------------------------------------------------- @@ -42,10 +46,31 @@ int getbmpheader(FILE * file, INFOHEADER *header) { int retval; - unsigned char buffer[4]; - // printf("\n %d", sizeof(JPEGHEADER)); +#ifdef __MICROBLAZE + +// sysace_fread(header, 1, 14, file); +// retval = sysace_fread(header, 1, sizeof(INFOHEADER), file); + + memcpy(header, bmpimage+14, sizeof(INFOHEADER)); + + header->size = htonl(header->size); + header->width = htonl(header->width); + header->height = htonl(header->height); + header->planes = hton(header->planes); + header->bits = hton(header->bits); + header->compression = htonl(header->compression); + header->imagesize = htonl(header->imagesize); + header->xresolution = htonl(header->xresolution); + header->yresolution= htonl(header->yresolution); + header->ncolours= htonl(header->ncolours); + header->importantcolours= htonl(header->importantcolours); + + return 1; + +#else fseek(file,14,SEEK_SET); retval = fread(header, sizeof(INFOHEADER), 1, file); +#endif return retval; } @@ -75,7 +100,7 @@ //Number of Quatization Tables QTcount = 2; headerlength = 12; //12 bytes are needed for the markers - huffmantablecount = 4; //2 AC and 2 DC tables + huffmantablecount = 4; // // 2 AC and 2 DC tables huffmantablesize = 0; jpegheader = &_jpegheader;//(JPEGHEADER *)malloc(550); @@ -147,6 +172,11 @@ jpegheader->sof0.ImageHeight[1] = header->height & 0xff; jpegheader->sof0.ImageWidth[0] = (header->width & 0xff00) >> 8; jpegheader->sof0.ImageWidth[1] = header->width & 0xff; +#ifdef __MICROBLAZE + xil_printf("--->%d %d %d %d\r\n", jpegheader->sof0.ImageHeight[0], jpegheader->sof0.ImageHeight[1], jpegheader->sof0.ImageWidth[0], jpegheader->sof0.ImageWidth[1]); +#else + printf("--->%d %d %d %d\r\n", jpegheader->sof0.ImageHeight[0], jpegheader->sof0.ImageHeight[1], jpegheader->sof0.ImageWidth[0], jpegheader->sof0.ImageWidth[1]); +#endif jpegheader->sof0.Components = components; for (i=0; i < components; i++) { jpegheader->sof0.ComponentInfo[i][0] = i+1; //color component @@ -220,9 +250,14 @@ jpegheader->sos.Ignore[1] = 0x3f; jpegheader->sos.Ignore[2] = 0x00; +#ifdef __MICROBLAZE + sysace_fwrite(jpegheader, 1, headerlength, file); + xil_printf("jpeg header size %x\r\n", headerlength); +#else fwrite(jpegheader,headerlength,1,file); + printf("jpeg header size %x\r\n", headerlength); +#endif - // free(jpegheader); } void writejpegfooter(FILE * file) @@ -230,22 +265,51 @@ unsigned char footer[2]; footer[0] = 0xff; footer[1] = 0xd9; - fseek(file,0,SEEK_END); +#ifdef __MICROBLAZE + sysace_fwrite(footer, 1, sizeof(footer), file); +#else +// fseek(file,0,SEEK_END); fwrite(footer,sizeof(footer),1,file); +#endif } +static unsigned char buffer[MATRIX_SIZE*3]; +static int __count2=0; + void readbmpfile(FILE * file, signed char pixelmatrix[MATRIX_SIZE][MATRIX_SIZE*3], unsigned int mrow, unsigned int mcol, INFOHEADER * header) { unsigned int row, col; - unsigned char buffer[MATRIX_SIZE*3]; + int offset; + for(row = 0;row < MATRIX_SIZE; row++) { //Find first point of row in the matrix to be read. +#ifdef __MICROBLAZE +// sysace_fread(buffer, 1, MATRIX_SIZE*3, file); + offset = bmpsize-3*header->width*(row + 1 + mrow*MATRIX_SIZE)+MATRIX_SIZE*3*mcol; + memcpy(buffer, bmpimage + offset, MATRIX_SIZE*3); +#else fseek(file,-(3*header->width*(row + 1 + mrow*MATRIX_SIZE)-(MATRIX_SIZE*3)*mcol),SEEK_END); //Read row from matrix fread(buffer, 1, MATRIX_SIZE*3, file); //copy row into pixelmatrix +#endif for(col = 0; col < MATRIX_SIZE*3; col++) { pixelmatrix[row][col] = buffer[col]- 128; +#if 0 +#ifdef __MICROBLAZE + if (__count2<4*24*8) { + xil_printf("%x ", pixelmatrix[row][col]); + __count2++; + if ((__count2&0x0f)==0) xil_printf("\r\n"); + } +#else + if (__count2<4*24*8) { + printf(" %x ", pixelmatrix[row][col]); + __count2++; + if ((__count2&0x0f)==0) printf("\r\n"); + } +#endif +#endif } } } @@ -262,6 +326,8 @@ return ((112*r - 94*g - 18*b + 128)>>8)+128; } +static int __count1=120; + void RGB2YCrCb(signed char pixelmatrix[MATRIX_SIZE][MATRIX_SIZE*3],signed char YMatrix[MATRIX_SIZE][MATRIX_SIZE],signed char CrMatrix[MATRIX_SIZE][MATRIX_SIZE],signed char CbMatrix[MATRIX_SIZE][MATRIX_SIZE]) { unsigned int row, col; @@ -270,6 +336,19 @@ YMatrix[row][col] = RGB2Y(pixelmatrix[row][col*3+2],pixelmatrix[row][col*3+1],pixelmatrix[row][col*3]) - 128; CrMatrix[row][col] = RGB2Cr(pixelmatrix[row][col*3+2],pixelmatrix[row][col*3+1],pixelmatrix[row][col*3]) - 128; CbMatrix[row][col] = RGB2Cb(pixelmatrix[row][col*3+2],pixelmatrix[row][col*3+1],pixelmatrix[row][col*3]) - 128; +#if 0 +#ifdef __MICROBLAZE + if (__count1<64) { + xil_printf("-------------->%x %x %x\r\n", YMatrix[row][col], CrMatrix[row][col], CbMatrix[row][col]); + __count1++; + } +#else + if (__count1<64) { + printf("-------------->%x %x %x\r\n", YMatrix[row][col], CrMatrix[row][col], CbMatrix[row][col]); + __count1++; + } +#endif +#endif } } } 1.3 mb-jpeg/encoder/main.c http://www.opencores.org/cvsweb.shtml/mb-jpeg/encoder/main.c.diff?r1=1.2&r2=1.3 (In the diff below, changes in quantity of whitespace are not shown.) Index: main.c =================================================================== RCS file: /cvsroot/quickwayne/mb-jpeg/encoder/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- main.c 17 Jul 2006 00:49:19 -0000 1.2 +++ main.c 18 Jul 2006 02:12:31 -0000 1.3 @@ -1,3 +1,135 @@ +#ifdef __MICROBLAZE + +#include <stdio.h> +#include <stdlib.h> + +#include "xup2pro.h" + +#include "zzq.h" +#include "io.h" +#include "huffman.h" +#include "dct.h" + +char* bmpimage; +int bmpsize; + +INFOHEADER _bmpheader; + +static signed char pixelmatrix[MATRIX_SIZE][MATRIX_SIZE*3],YMatrix[MATRIX_SIZE][MATRIX_SIZE],CrMatrix[MATRIX_SIZE][MATRIX_SIZE],CbMatrix[MATRIX_SIZE][MATRIX_SIZE]; +static signed short temp[MATRIX_SIZE][MATRIX_SIZE], dctresult[MATRIX_SIZE][MATRIX_SIZE]; +static signed char output[MATRIX_SIZE][MATRIX_SIZE]; +static signed char bitstream[NUMBER_OF_PIXELS] ; +static unsigned char header[389]; + +int ejpgl_error(int errno, void* remark); + +int main() +{ + SYSACE_FILE *infile; + SYSACE_FILE *outfile; + SYSACE_FILE* outfile2; + + int i; + INFOHEADER *bmpheader; + JPEGHEADER *jpegheader; + unsigned int col, cols, row, rows, remaining,component; + unsigned char amount_remaining, Ydcvalue, Cbdcvalue, Crdcvalue ; + int encode, compression; + + encode = 1; + compression = 0; + + bmpimage=(unsigned char*)0x70000000; + bmpsize=0; + + xil_printf("\r\nBMP2JPG Code Compiled at %s %s\r\n", __DATE__, __TIME__); + + bmpheader=&_bmpheader; + + if ((infile = sysace_fopen("image01.bmp", "r")) == NULL) { + ejpgl_error(eOPENINPUT_FILE, 0); + } + + bmpsize = sysace_fread(bmpimage, 1, 65536, infile); + xil_printf("bmpsize %d\r\n", bmpsize); + if (bmpsize==65536) { + ejpgl_error(eLARGE_INPUTFILE, 0); + } + + if ((outfile2 = sysace_fopen("image01b.bmp", "w")) == NULL) { + ejpgl_error(eOPENOUTPUT_FILE, 0); + } + sysace_fwrite(bmpimage, 1, bmpsize, outfile2); + sysace_fclose(outfile2); + + if (getbmpheader(infile,bmpheader) == 0) { //File is a valid BMP + ejpgl_error(eINVALID_BMP, 0); + } + + xil_printf("Image width: %d pixels\r\n", bmpheader->width); + xil_printf("Image height: %d pixels\r\n", bmpheader->height); + + rows = bmpheader->height>>3; + cols = bmpheader->width>>3; + remaining=0x00; + amount_remaining=0x00; + Ydcvalue = 0x00; + Crdcvalue = 0x00; + Cbdcvalue = 0x00; + + if ((outfile = sysace_fopen("image01.jpg", "w")) == NULL) { + ejpgl_error(eOPENOUTPUT_FILE, 0); + } + + writejpegheader(outfile,bmpheader); + + for (row = 0; row < rows; row++) { + for (col = 0; col < cols; col++) { + readbmpfile(infile,pixelmatrix,row,col,bmpheader); + RGB2YCrCb(pixelmatrix,YMatrix,CrMatrix,CbMatrix); + for(component=0;component<3;component++) { + switch (component) { + case 0 ://Y-encoding + dct(YMatrix,dctresult); + zzq(dctresult,bitstream,compression,encode); + Ydcvalue = EncodeDataUnit(bitstream,Ydcvalue,outfile, &remaining, &amount_remaining,component); + break; + case 1 ://Cr-encoding + dct(CrMatrix,dctresult); + zzq(dctresult,bitstream,compression,encode); + Crdcvalue = EncodeDataUnit(bitstream,Crdcvalue,outfile, &remaining, &amount_remaining,component); + break; + case 2 ://Cb-encoding + dct(CbMatrix,dctresult); + zzq(dctresult,bitstream,compression,encode); + Cbdcvalue = EncodeDataUnit(bitstream,Cbdcvalue,outfile, &remaining, &amount_remaining,component); + break; + } + } + } + } + HuffmanEncodeFinishSend(&remaining,&amount_remaining,outfile); + xil_printf("\r\nProcessed %d %dx%d-blocks.\r\n",(row-1)*cols+col,MATRIX_SIZE,MATRIX_SIZE); + writejpegfooter(outfile); + + + sysace_fclose(outfile); + sysace_fclose(infile); + return 0; + +} + +int ejpgl_error(int errno, void* remark) { + + xil_printf("--> Error %d\r\n", errno); + exit(1); + +} + + + +#else + //--------------------------------------------------------------------------- typedef union { /* block of pixel-space values */ unsigned char block[8][8]; @@ -168,3 +300,6 @@ return 0; } //--------------------------------------------------------------------------- + +#endif + 1.2 mb-jpeg/encoder/zzq.c http://www.opencores.org/cvsweb.shtml/mb-jpeg/encoder/zzq.c.diff?r1=1.1&r2=1.2 (In the diff below, changes in quantity of whitespace are not shown.) Index: zzq.c =================================================================== RCS file: /cvsroot/quickwayne/mb-jpeg/encoder/zzq.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- zzq.c 17 Jul 2006 00:31:42 -0000 1.1 +++ zzq.c 18 Jul 2006 02:12:31 -0000 1.2 @@ -4,9 +4,8 @@ #pragma hdrstop //--------------------------------------------------------------------------- #pragma argsused -void zzq(signed short pixelmatrix[MATRIX_SIZE][MATRIX_SIZE], signed char *bitstream, int compression, int encode) -{ -unsigned char quantization_table[MATRIX_SIZE][MATRIX_SIZE] ={ + +static unsigned char quantization_table[MATRIX_SIZE][MATRIX_SIZE] ={ {4, 3, 3, 4, 4, 5, 6, 6}, {3, 3, 4, 4, 5, 6, 6, 6}, {4, 4, 4, 4, 5, 6, 6, 6}, @@ -16,6 +15,11 @@ {6, 6, 6, 6, 7, 7, 7, 7}, {6, 6, 6, 7, 7, 7, 7, 7} }; + +//static int __count3=0; + +void zzq(signed short pixelmatrix[MATRIX_SIZE][MATRIX_SIZE], signed char *bitstream, int compression, int encode) +{ int i, x, y, jumped, deltax, deltay; x = y = deltax = deltay = jumped = 0; @@ -30,6 +34,21 @@ else bitstream[i] = -((-pixelmatrix[y][x])>>quantization_table[y][x]); // printf("%i ",bitstream[i]); +#if 0 + #ifdef __MICROBLAZE + if (__count3<256*3) { + xil_printf("%x ", bitstream[i]); + __count3++; + if ((__count3&0x0f)==0) xil_printf("\r\n"); + } +#else + if (__count3<256*3) { + printf(" %x ", bitstream[i]); + __count3++; + if ((__count3&0x0f)==0) printf("\r\n"); + } +#endif +#endif } if((y == 0) || (y == MATRIX_SIZE-1)) { //on top or bottom side of matrix

     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.