資源簡介
將yuv各種格式的圖片轉換為jpg格式的,在程序中定義文件按路徑即可。
代碼片段和文件信息
//?jpeg1.cpp?:?Defines?the?entry?point?for?the?console?application.
//
#include?“stdafx.h“
#include?“jpeg1.h“
//=================================================================================
//??Function?name:??main
//??Description:????The?starting?point?of?the?program
//??Parameters:?????standard?command?line?input
//=================================================================================
int?main(int?argc?char?*argv[])
{
????//?-----------------------------??Application?input/output?Variables?-----------------------------------
????char????input_filename[FILENAME_SIZE]???=?“f:\\yellow_yuv420_planar_252x176.yuv“;
????char????output_filename[FILENAME_SIZE]??=?“f:\\1234.jpg“;?
????char????debug_filename[FILENAME_SIZE]???=?““;?
????UINT16??ScaledImageWidth?=?252;
????UINT16??ScaledImageHeight?=?176;???
????UINT16??ScaledImageQuality?=?95;??
????UINT16??MaintainResultionRatio?=?1;?
????UINT16??DebugImageOutput?=?0;
????UINT16??InputFormat?=8;
????UINT16??VerboseMode?=?1;
????//--------------------------------------?Buffer?for?decoder??--------------------------------------------
????UINT8???*decoder_input_stream???=??NULL;????//?Buffer?to?hold?the?compressed?and?undecoded?JPEG?bitstream?data?read?from?JPEG?file
????UINT8???*decoded_image_buffer???=??NULL;????//?Buffer?to?store?the?decoded?image?in?raw?YUV?pixles?
????//--------------------------------------?Buffer?for?encoder??--------------------------------------------
????UINT8???*ScaledImage_YUV444?????=??NULL;????//?scaled?image?in?packed?444?format
????UINT8???*encoded_jpeg_buffer????=??NULL;????//?Buffer?to?hold?compressed?JPEG?bitstream
????UINT8???*encoded_jpeg_buffer_ptr=??NULL;????//?Pointer?to?point?to?the?encoding?bit?position
????UINT8???*ImageToEncode??????????=??NULL;????//?image?to?encoder
????//------------------------------------------?File?pointers??--------------------------------------------
????FILE????*DecoderFile????=??NULL;
????FILE????*EncoderFile????=??NULL;
????FILE????*fdebug?????????=??NULL;
????//--------------------------------------?Input?JPEG?image?info?-----------------------------------------
????UINT16??decoder_image_format;
????UINT16??encoder_image_format;
????UINT16??image_width?image_height;?
????UINT32??FileStartPos;
????UINT32??FileLength;
????INT32???ret;
????UINT32??Hfactor;
????UINT32??Vfactor;
????
?
????//-----------------------------------???Process?command?line?arguments??--------------------------------
????if(?!ParseCommands(?argc?argv?input_filename?output_filename??
????????????????????????&ScaledImageHeight??&ScaledImageWidth?&ScaledImageQuality?
????????????????????????&MaintainResultionRatio?&DebugImageOutput?&InputFormat?&VerboseMode))
????{
????????return?-1;
????}
????//-------------------------????check?for?input/output?filenames?and?parameter?-------------------------???
????if(strlen(input_filename)?==?0?)
????{
????????printf(“input?filena
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????253993??2009-04-17?20:29??jpeg1\Debug\jpeg1.exe
?????文件?????220040??2009-04-17?20:29??jpeg1\Debug\jpeg1.ilk
?????文件??????19287??2009-04-17?20:29??jpeg1\Debug\jpeg1.obj
?????文件?????186964??2009-04-14?08:02??jpeg1\Debug\jpeg1.pch
?????文件?????402432??2009-04-17?20:29??jpeg1\Debug\jpeg1.pdb
?????文件???????1491??2009-04-14?08:02??jpeg1\Debug\StdAfx.obj
?????文件??????41984??2009-04-17?20:29??jpeg1\Debug\vc60.idb
?????文件??????53248??2009-04-17?20:29??jpeg1\Debug\vc60.pdb
?????文件??????18534??2009-04-17?16:21??jpeg1\jpeg1.cpp
?????文件???????4584??2009-04-14?17:39??jpeg1\jpeg1.dsp
?????文件????????516??2009-04-14?07:59??jpeg1\jpeg1.dsw
?????文件???????3338??2009-04-17?20:28??jpeg1\jpeg1.h
?????文件??????50176??2009-04-17?20:29??jpeg1\jpeg1.ncb
?????文件??????48640??2009-04-17?20:29??jpeg1\jpeg1.opt
?????文件???????1007??2009-04-17?20:29??jpeg1\jpeg1.plg
?????文件????????133??2009-04-17?20:29??jpeg1\jpeg1.positions
?????文件???????1202??2009-04-14?07:59??jpeg1\ReadMe.txt
?????文件????????292??2009-04-14?07:59??jpeg1\StdAfx.cpp
?????文件????????667??2009-04-14?07:59??jpeg1\StdAfx.h
?????目錄??????????0??2009-04-17?20:29??jpeg1\Debug
?????目錄??????????0??2009-04-17?20:29??jpeg1
-----------?---------??----------?-----??----
??????????????1308528????????????????????21
- 上一篇:匯編語言編譯器masm5.0
- 下一篇:操作系統課程設計完整版
評論
共有 條評論