📄 ejpgl.cpp
字号:
// ejpgl.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
//#include "stdafx.h"
#include <stdio.h>
#include "ejpgl.h"
extern "C" INFOHEADER *bmpheader;
signed char pixelmatrix[MACRO_BLOCK_SIZE][MACRO_BLOCK_SIZE*3];
signed char YMatrix[MATRIX_SIZE][MATRIX_SIZE];
signed char CrMatrix[MATRIX_SIZE][MATRIX_SIZE];
signed char CbMatrix[MATRIX_SIZE][MATRIX_SIZE];
extern "C" int openBMPJPG(int argc, char* bmpfilename, char* jpgfilename);
extern "C" int closeBMPJPG();
extern "C" int dct_init_start();
extern "C" int zzq_encode_init_start(int compression);
extern "C" int vlc_init_start();
extern "C" void get_MB(int mb_row, int mb_col, signed char pixelmatrix[MACRO_BLOCK_SIZE][MACRO_BLOCK_SIZE*3]);
extern "C" void RGB2YCrCb(signed char pixelmatrix[MACRO_BLOCK_SIZE][MACRO_BLOCK_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 sample);
extern "C" void dct(signed char pixels[8][8], int color);
extern "C" int dct_stop_done() ;
extern "C" int zzq_encode_stop_done();
extern "C" int vlc_stop_done();
int main(int argc, char* argv[])
{
int compression =0,sample;
unsigned int col, cols, row, rows;
openBMPJPG(argc, argv[1], argv[2]);
//openBMPJPG(argc, "test.bmp", "test.jpg");
rows = bmpheader->height>>4;
cols = bmpheader->width>>4;
dct_init_start();
zzq_encode_init_start(compression);
vlc_init_start();
for (row = 0; row < rows; row++) {
for (col = 0; col < cols; col++) {
get_MB(row, col, pixelmatrix);
for(sample=0;sample<5;sample++) {
if(sample<4) {
RGB2YCrCb(pixelmatrix,YMatrix,CrMatrix,CbMatrix,sample);
dct(YMatrix,0);
} else {
dct(CrMatrix,1);
dct(CbMatrix,2);
}
}
}
}
dct_stop_done();
zzq_encode_stop_done();
vlc_stop_done();
closeBMPJPG();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -