"Go" VS2013 compile Libjpeg Library

Source: Internet
Author: User

Original address: http://blog.csdn.net/weixinhum/article/details/42718959

Now, many image processing tools and open source libraries give the function interface of image decoding, but sometimes these interfaces do not fully meet our needs, such as if we want to directly decode the JPEG data in memory, there is no such interface.

As a result of the previous project just good equipment transmitted image data is JPEG format, if the image data to save each frame to file and then use the interface provided by the open Source Library to read into the file will be very plunges, so do some direct decoding in-memory JPEG data research. After comparison found that the Libjpeg library to JPEG image codec support is very good, and compared to the OpenCV library, the complexity is much smaller, it is therefore decided to implement the interface I want to do.

The so-called "paddle", to use the Libjpeg library, the first step is naturally to download its source code, here.

After downloading the solution decompression, it is necessary to compile the Libjpeg library, here I mainly refer to this article and this article. Because the first article is VS2012, some paths are slightly different from this article, so if you are using VS2012, please do not hesitate to open the link, follow his steps to do it. Of course, it is to say, VS2013 is really good to use too much.

OK, now it's time to prepare for the compilation, in fact it's two steps:

The first step: Find the "jpeg-9a" folder just extracted from the "makefile.vc" file, with Notepad or notepad++ and other editing tools to open, and then find the inside of the "!include <win32.mak>", will " Win32.mak "to absolute path. It is not difficult to see this win32.mak is a file, it is a file under VS, so the path is related to your own version of VS, I installed the VS2013 version, by default, this file in the version of "C:\Program files (x86) \microsoft Sdks\windows\v7.1a\include "under this directory. So we'll just search for that sentence to "!include <c:\program Files (x86) \microsoft Sdks\windows\v7.1a\include\win32.mak>" is OK.

Second step: Open VS2013 command line: "VS2013 x86 native tool command Prompt", this opens with the Start menu convenient point, directly find the "Visual Studio 2013" This item, open the inside of the "Visual Studio Tools" folder can be seen. If you are a WIN8 user, it is recommended to install a Start menu tool, or go to the VS installation directory below. Open the command line after the CD to the extracted "jpeg-9a" directory, input "nmake/f makefile.vc setup-v10", enter, until the command line after the command, the preparation is done. Operations on the command line, as follows:

The following to do the compilation, in fact, there is no difficulty, the above work is done, the "jpeg-9a" folder will generate a VS project. Run directly inside the "Jpeg.sln", and then vs hint to upgrade the compiler what point is that after entering the programming interface directly compiled is done. After compiling, you can see a "jpeg.lib" file in the "Release" folder under the "jpeg-9a" folder, which is the static link library we just compiled.

To use this static link library, just include the three header files into Jconfig.h,jmorecfg.h,jpeglib.h, and then add the jpeg.lib that you just compiled into the project. It's customary to rename Jpeg.lib to Libjpeg.lib. Here is a JPEG to BMP example, the code is basic copy of this article, only made a few changes.

Engineering

Introduction to the implementation of decoding JPEG data in memory, the article address is as follows: http://blog.csdn.net/weixinhum/article/details/43089047

"Go" VS2013 compile Libjpeg Library

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.