Transplantation and use of JPG library

1. Third-party source code compilation routine

1. Configuration: Generate a Makefile according to the specific conditions of the current platform

                Execute ./configure --prefix=... --host=...

  • Default behavior:
    • By default, it is installed under /usr/local, and the installation path can be specified by --prefix=
    • The compiler used by default is gcc, and the prefix of a specific compiler can be specified by --host=
       

 2. Compile: According to the generated Makefile, guide the compiler of the current platform to compile all source codes

               execute make

3. Installation: Store the compiled and configured library files, header files, etc. in the specified location

              Execute make install

4. The final result is to get the following four folders in the specified installation directory

! ! Notice! !

The above operations should be performed in the home directory, not in shared folders, and not in other places without permissions. Use sudo with caution

2. Deployment of the JPG library on the development board

  • Compress all compiled files

gec@ubuntu:~$ tar czvf jpeg.tar.gz bin/ include/ lib/ share/

  • Transfer the compressed package jpeg.tar.gz to the development board
  • In the development board, decompress the compressed package: (Note: To avoid conflicts, it is best to decompress into the specified empty directory)

[root@GEC6818:~]# tar xzvf jpeg.tar.gz -C ... (specify an empty directory)

  • Enter the bin/ directory and set the PATH environment variable:

[root@GEC6818:~/bin]# export PATH=$PATH:`pwd`

  • Enter the lib/ directory and set the LD_LIBRARY_PATH environment variable:

[root@GEC6818:~/lib]# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`

Note: The equal sign of the environment variable setting = no spaces on the left and right sides

3. JPG data decoding process


  • In the above code, the following information should be noted:
    • Line 11, jpg_data and jpg_size are the data and size obtained by the user from the jpg picture, which is the raw material for decoding
    • Lines 26 and 27 are the RGB data and its size obtained after the final decoding is completed, which is the decoding result
    • The rest of the code is a fixed process, you only need a rough understanding, no need to study line by line

Guess you like

Origin blog.csdn.net/weixin_49071468/article/details/129896990