OpenCores
URL https://opencores.org/ocsvn/mb-jpeg/mb-jpeg/trunk

Subversion Repositories mb-jpeg

[/] [mb-jpeg/] [tags/] [STEP1_2/] [mb-bmp2jpg/] [bmp2jpg.c] - Blame information for rev 57

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 56 quickwayne
#include <stdio.h>
2
#include "ejpgl.h"
3
 
4
extern INFOHEADER *bmpheader;
5
 
6
signed char pixelmatrix[MACRO_BLOCK_SIZE][MACRO_BLOCK_SIZE*3];
7
signed char YMatrix[MATRIX_SIZE][MATRIX_SIZE];
8
signed char CrMatrix[MATRIX_SIZE][MATRIX_SIZE];
9
signed char CbMatrix[MATRIX_SIZE][MATRIX_SIZE];
10
 
11
 
12
int main(int argc, char* argv[])
13
{
14
        int compression,sample;
15
        unsigned int col, cols, row, rows;
16
 
17 57 quickwayne
        openBMPJPG(argc, argv[1], argv[2]);
18 56 quickwayne
 
19
        rows = bmpheader->height>>4;
20
       cols = bmpheader->width>>4;
21
 
22
        dct_init_start();
23
        zzq_encode_init_start(compression);
24
        vlc_init_start();
25
 
26
       for (row = 0; row < rows; row++) {
27
                for (col = 0; col < cols; col++) {
28
                        get_MB(row, col, pixelmatrix);
29
                        for(sample=0;sample<5;sample++) {
30
                                if(sample<4) {
31
                                        RGB2YCrCb(pixelmatrix,YMatrix,CrMatrix,CbMatrix,sample);
32
                                        dct(YMatrix,0);
33
                                } else {
34
                                        dct(CrMatrix,1);
35
                                        dct(CbMatrix,2);
36
                                }
37
                        }
38
                }
39
         }
40
 
41
        dct_stop_done();
42
        zzq_encode_stop_done();
43
        vlc_stop_done();
44
 
45
        closeBMPJPG();
46
        return 0;
47
 
48
}
49
 
50
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.