CN112929621A - Method for improving image compression transmission based on Huffman algorithm - Google Patents

Method for improving image compression transmission based on Huffman algorithm Download PDF

Info

Publication number
CN112929621A
CN112929621A CN202110078270.4A CN202110078270A CN112929621A CN 112929621 A CN112929621 A CN 112929621A CN 202110078270 A CN202110078270 A CN 202110078270A CN 112929621 A CN112929621 A CN 112929621A
Authority
CN
China
Prior art keywords
pixel
channel
picture
new
compression
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110078270.4A
Other languages
Chinese (zh)
Inventor
朱代豪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen compuchip Information Technology Co.,Ltd.
Original Assignee
Shenzhen Vclusters Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Vclusters Information Technology Co ltd filed Critical Shenzhen Vclusters Information Technology Co ltd
Priority to CN202110078270.4A priority Critical patent/CN112929621A/en
Publication of CN112929621A publication Critical patent/CN112929621A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/64Circuits for processing colour signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/79Processing of colour television signals in connection with recording
    • H04N9/80Transformation of the television signal for recording, e.g. modulation, frequency changing; Inverse transformation for playback

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

The invention relates to a method for improving image compression transmission based on a Huffman algorithm, which comprises the following steps: reading picture data, scanning the picture data pixel by pixel, and separating an R, G, B channel of each pixel; reassembling the separated RGB channels into new pixel RGB data; and carrying out Hash method compression on the new pixel RGB data, and storing the new pixel RGB data into a new file to form compressed picture data. The picture bitmap is composed of a plurality of pixels, one pixel is composed of four ARGB channels, on the premise that the picture quality is guaranteed, the transparency channel A can be removed, one pixel occupies one quarter of the memory, the volume of one picture is optimized by 25%, and the transmission speed of the picture is favorably improved.

Description

Method for improving image compression transmission based on Huffman algorithm
Technical Field
The invention relates to the technical field of image processing, in particular to a method for improving image compression and transmission based on a Huffman algorithm.
Background
With the popularization of smart phones and the continuous improvement of mobile phone pixels, at present, people take pictures by using mobile phones, pictures are shared by friends, the frequency of sending the pictures to friend circles is higher and higher, the occupied memory for taking the same picture is larger and larger due to the improvement of the pixels, the user experience effect is poorer and poorer due to the fact that the picture is transmitted in a network with lower and slower efficiency due to the increase of the picture volume, and how to meet the trend that the picture demand of people is developed in the future is met.
The android picture transmission occupies a large memory, the transmission efficiency is low, the graphics engine library with the system self-carrying ski (the core library is the libjpeg library) is utilized, the system version and the *** system limit (the low-version *** is castrated with the Huffman algorithm), and the customized picture processing can not be well compatible with the full version.
Disclosure of Invention
The invention provides a method for improving image compression and transmission based on a Huffman algorithm aiming at the problems. The invention utilizes the Huffman algorithm of the library to carry out customized compression processing on the picture according to the requirement, thereby achieving the purpose that the picture is compatible with the full version and the polarized transmission.
In order to achieve the purpose, the specific technical scheme of the invention is as follows:
a method for improving image compression transmission based on a Huffman algorithm comprises the following steps:
s1, reading picture data, scanning the picture data pixel by pixel, and separating a R, G, B channel of each pixel;
s2, reassembling the separated RGB channels into new pixel RGB data;
and S3, carrying out Hash method compression on the new pixel RGB data, and storing the new pixel RGB data into a new file to form compressed picture data.
Preferably, the method for separating the R, G, B channel of each pixel in step S1 is as follows:
shifting the R channel in the pixel to the right by 16 bits and then &0xFF, and storing a new R channel;
shifting the G channel in the pixel to the right by 8 bits and then comparing the G channel with 0xFF, and storing a new G channel;
and finally, performing B channel &0xFF on the pixel.
Preferably, step S3 is specifically:
creating jpeg compression object, storing the file in a directory, and setting compression parameters; and the channel mode of the picture is RGB, starting a Huffman function, starting compression, circularly writing each line of data, and completing compression to release the jpeg object.
Further, the compression parameter is picture width and height.
The picture bitmap is composed of a plurality of pixels, one pixel is composed of four ARGB channels, on the premise that the picture quality is guaranteed, the transparency channel A can be removed, one pixel occupies one quarter of the memory, the volume of one picture is optimized by 25%, and the transmission speed of the picture is favorably improved.
Detailed Description
In order that those skilled in the art will be able to understand and practice the present invention, further description will be given below of embodiments of the present invention.
The invention provides a method for improving image compression transmission based on a Huffman algorithm, which comprises the following steps:
s1, reading picture data, scanning the picture data pixel by pixel, and separating a R, G, B channel of each pixel;
in step S1, the method for separating the R, G, B channel of each pixel includes:
shifting the R channel in the pixel to the right by 16 bits and then &0xFF, and storing a new R channel;
shifting the G channel in the pixel to the right by 8 bits and then comparing the G channel with 0xFF, and storing a new G channel;
and finally, performing B channel &0xFF on the pixel.
S2, reassembling the separated RGB channels into new pixel RGB data;
and S3, carrying out Hash method compression on the new pixel RGB data, and storing the new pixel RGB data into a new file to form compressed picture data.
Wherein, step S3 specifically includes:
creating jpeg compression object, storing files in a directory, and setting compression parameters, such as picture width and height; and the channel mode of the picture is RGB, starting a Huffman function, starting compression, circularly writing each line of data, and completing compression to release the jpeg object.
The principle of the invention is as follows:
1) the picture bitmap is composed of a plurality of pixels, one pixel is composed of argb four channels, on the premise that the picture quality is guaranteed, a transparency channel can be removed, the memory occupied by one pixel is reduced by one quarter, and the volume of one picture is optimized by 25%.
Analyzing bitmap to obtain argb data, obtaining internal information to obtain pixel information in a picture, obtaining each pixel of the picture through double circulation of the width and the height of the picture, shifting an r channel in the pixel to the right by 16 bits and then storing a new r channel by &0xFF, shifting a g channel in the pixel to the right by 8 bits and then storing a new g channel by &0xFF, then shifting a b channel in the pixel by &0xFF, and finally reassembling the rgb data (corresponding to the step S1/2 of the invention).
2) And processing the obtained information of the new picture according to the requirements, such as the width, height, quality and path of the final expected picture, starting Huffman algorithm compression, and storing the compressed information into a new file.
Creating a jpeg compression object (object), storing the file in a directory, setting compression parameters such as the width and the height of a picture, setting the channel mode of the picture to rgb, starting a huffman function, starting compression, circularly writing each line of data, and releasing the jpeg object after the compression is completed (corresponding to step S3 of the present invention).
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (4)

1. A method for improving image compression transmission based on Huffman algorithm is characterized by comprising the following steps:
s1, reading picture data, scanning the picture data pixel by pixel, and separating a R, G, B channel of each pixel;
s2, reassembling the separated RGB channels into new pixel RGB data;
and S3, carrying out Hash method compression on the new pixel RGB data, and storing the new pixel RGB data into a new file to form compressed picture data.
2. The method of claim 1, wherein the step S1 of separating the R, G, B channel of each pixel comprises:
shifting the R channel in the pixel to the right by 16 bits and then &0xFF, and storing a new R channel;
shifting the G channel in the pixel to the right by 8 bits and then comparing the G channel with 0xFF, and storing a new G channel;
and finally, performing B channel &0xFF on the pixel.
3. The method for improving the compressed transmission of the pictures based on the huffman algorithm according to the claim 1 or 2, wherein the step S3 is specifically as follows:
creating jpeg compression object, storing the file in a directory, and setting compression parameters; and the channel mode of the picture is RGB, starting a Huffman function, starting compression, circularly writing each line of data, and completing compression to release the jpeg object.
4. The method of claim 3, wherein the compression parameter is picture width and height.
CN202110078270.4A 2021-01-20 2021-01-20 Method for improving image compression transmission based on Huffman algorithm Pending CN112929621A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110078270.4A CN112929621A (en) 2021-01-20 2021-01-20 Method for improving image compression transmission based on Huffman algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110078270.4A CN112929621A (en) 2021-01-20 2021-01-20 Method for improving image compression transmission based on Huffman algorithm

Publications (1)

Publication Number Publication Date
CN112929621A true CN112929621A (en) 2021-06-08

Family

ID=76165067

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110078270.4A Pending CN112929621A (en) 2021-01-20 2021-01-20 Method for improving image compression transmission based on Huffman algorithm

Country Status (1)

Country Link
CN (1) CN112929621A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004040300A (en) * 2002-07-01 2004-02-05 Fuji Photo Film Co Ltd Image processing apparatus
CN102821279A (en) * 2012-07-31 2012-12-12 北京天神互动科技有限公司 Picture compression method keeping with alpha channel
CN103826028A (en) * 2012-11-19 2014-05-28 腾讯科技(深圳)有限公司 Method and device for compressing picture in lossless way
CN111147861A (en) * 2020-01-02 2020-05-12 广州虎牙科技有限公司 Image compression method, device, user equipment and computer readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004040300A (en) * 2002-07-01 2004-02-05 Fuji Photo Film Co Ltd Image processing apparatus
CN102821279A (en) * 2012-07-31 2012-12-12 北京天神互动科技有限公司 Picture compression method keeping with alpha channel
CN103826028A (en) * 2012-11-19 2014-05-28 腾讯科技(深圳)有限公司 Method and device for compressing picture in lossless way
CN111147861A (en) * 2020-01-02 2020-05-12 广州虎牙科技有限公司 Image compression method, device, user equipment and computer readable storage medium

Similar Documents

Publication Publication Date Title
US10812835B2 (en) Encoding method and apparatus and decoding method and apparatus
CN109005426B (en) Picture file processing method
CN109640085B (en) Image processing apparatus and method
WO2020010997A1 (en) Video frame extraction method and apparatus, computer readable medium, and electronic device
CN109089162B (en) Picture file processing method and system
CA2769732C (en) Image processing device and method
EP2559270B1 (en) Method and apparatus for generating and playing animation message
CN109040789B (en) Picture file processing method
WO2013115024A1 (en) Image processing apparatus and image processing method
CN103748881A (en) Image processing device and image processing method
CN102833463A (en) Picture processing method and picture processing equipment
WO2022253249A1 (en) Feature data encoding method and apparatus and feature data decoding method and apparatus
CN112929621A (en) Method for improving image compression transmission based on Huffman algorithm
US12015777B2 (en) Signaling profile level exemptions for immersive video
CN102129702B (en) Image thumbnail making method and system thereof
CN113364964B (en) Image processing method, image processing apparatus, storage medium, and terminal device
CN110378973B (en) Image information processing method and device and electronic equipment
JP2018029389A (en) Image processing apparatus, method, and program
JP4739443B2 (en) Method and apparatus for processing digital images
CN101998125B (en) Image document transmission system and method
CN108200433A (en) A kind of compression of images and decompression method
CN113473150B (en) Image processing method and device and computer readable storage device
CN109905715A (en) It is inserted into the code stream conversion method and system of SEI data
US20230247213A1 (en) Moving image encoding and decoding
JP6241500B2 (en) Image processing apparatus and method, and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20211220

Address after: 518000 B901, Shenzhen national engineering laboratory building, No. 20, Gaoxin South seventh Road, high tech Zone community, Yuehai street, Nanshan District, Shenzhen, Guangdong

Applicant after: Shenzhen compuchip Information Technology Co.,Ltd.

Address before: 518000 Building 201, No. 1, Qianwan Road, Qianhai Shenzhen-Hong Kong Cooperation Zone, Shenzhen, Guangdong Province (Admitted to Shenzhen Qianhai Business Secretary Co., Ltd.)

Applicant before: SHENZHEN VCLUSTERS INFORMATION TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
RJ01 Rejection of invention patent application after publication

Application publication date: 20210608

RJ01 Rejection of invention patent application after publication