⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 huffman_tables.v

📁 基于FPGA的JPEG图像压缩芯片设计
💻 V
📖 第 1 页 / 共 5 页
字号:
/////////////////////////////////////////////////////////////////////////                                                             ////////  JPEG Entropy Coding, Huffman tables                        ////////                                                             ////////  These functions contain the default huffman tables as      ////////  described in ITU-T.81 (ISO/IEC-10918-1) Annex K.           ////////                                                             ////////  Author: Richard Herveille                                  ////////          richard@asics.ws                                   ////////          www.asics.ws                                       ////////                                                             /////////////////////////////////////////////////////////////////////////////                                                             //////// Copyright (C) 2001 Richard Herveille                        ////////                    richard@asics.ws                         ////////                                                             //////// This source file may be used and distributed without        //////// restriction provided that this copyright statement is not   //////// removed from the file and that any derivative work contains //////// the original copyright notice and the associated disclaimer.////////                                                             ////////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     //////// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   //////// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   //////// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      //////// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         //////// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    //////// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   //////// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        //////// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  //////// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  //////// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  //////// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         //////// POSSIBILITY OF SUCH DAMAGE.                                 ////////                                                             ///////////////////////////////////////////////////////////////////////////  CVS Log////  $Id: huffman_tables.v,v 1.2 2002/10/31 12:50:40 rherveille Exp $////  $Date: 2002/10/31 12:50:40 $//  $Revision: 1.2 $//  $Author: rherveille $//  $Locker:  $//  $State: Exp $///* *********************** *//* *** E N C O D I N G *** *//* *********************** *//*  J P E G _ D C _ L U M I N A N C E _ H U F F M A N _ E N C  ITU-T.81 annex K.3.1 Table K.3  This function translates the luminance DC coefficient difference  into the default huffman codeword.  Output is given as:  codelength[3:0]-1, codeword[8:0]  The codewords are right-alligned to ease bitstream generation.  example:  dc_luminance_coefficient = 3  codelength = 2 +1 = 3  codeword   = 9'b0_0000_0100 => 3'b100*/function [12:0] jpeg_dc_luminance_huffman_enc;  input [ 3:0] dc_luminance_coefficient;begin  case(dc_luminance_coefficient) // synopsys full_case parallel_case    4'h0: jpeg_dc_luminance_huffman_enc = {4'h1, 9'b0_0000_0000};    4'h1: jpeg_dc_luminance_huffman_enc = {4'h2, 9'b0_0000_0010};    4'h2: jpeg_dc_luminance_huffman_enc = {4'h2, 9'b0_0000_0011};    4'h3: jpeg_dc_luminance_huffman_enc = {4'h2, 9'b0_0000_0100};    4'h4: jpeg_dc_luminance_huffman_enc = {4'h2, 9'b0_0000_0101};    4'h5: jpeg_dc_luminance_huffman_enc = {4'h2, 9'b0_0000_0110};    4'h6: jpeg_dc_luminance_huffman_enc = {4'h3, 9'b0_0000_1110};    4'h7: jpeg_dc_luminance_huffman_enc = {4'h4, 9'b0_0001_1110};    4'h8: jpeg_dc_luminance_huffman_enc = {4'h5, 9'b0_0011_1110};    4'h9: jpeg_dc_luminance_huffman_enc = {4'h6, 9'b0_0111_1110};    4'ha: jpeg_dc_luminance_huffman_enc = {4'h7, 9'b0_1111_1110};    4'hb: jpeg_dc_luminance_huffman_enc = {4'h8, 9'b1_1111_1110};  endcaseendendfunction // jpeg_dc_luminance_huffman_enc/*  J P E G _ D C _ C H R O M I N A N C E _ H U F F M A N _ E N C  ITU-T.81 annex K.3.1 Table K.4  This function translates the chrominance DC coefficient difference  into the default huffman codeword.  Output is given as:  codelength[3:0]-1, codeword[10:0]  The codewords are right-alligned to ease bitstream generation.  example:  dc_chrominance_coefficient = 3  codelength = 2 +1 = 3  codeword   = 11'b0_0000_0110 => 3'b110*/function [14:0] jpeg_dc_chrominance_huffman_enc;  input [ 3:0] dc_chrominance_coefficient;begin  case(dc_chrominance_coefficient) // synopsys full_case parallel_case    4'h0: jpeg_dc_chrominance_huffman_enc = {4'h1, 11'b000_0000_0000};    4'h1: jpeg_dc_chrominance_huffman_enc = {4'h1, 11'b000_0000_0001};    4'h2: jpeg_dc_chrominance_huffman_enc = {4'h1, 11'b000_0000_0010};    4'h3: jpeg_dc_chrominance_huffman_enc = {4'h2, 11'b000_0000_0110};    4'h4: jpeg_dc_chrominance_huffman_enc = {4'h3, 11'b000_0000_1110};    4'h5: jpeg_dc_chrominance_huffman_enc = {4'h4, 11'b000_0001_1110};    4'h6: jpeg_dc_chrominance_huffman_enc = {4'h5, 11'b000_0011_1110};    4'h7: jpeg_dc_chrominance_huffman_enc = {4'h6, 11'b000_0111_1110};    4'h8: jpeg_dc_chrominance_huffman_enc = {4'h7, 11'b000_1111_1110};    4'h9: jpeg_dc_chrominance_huffman_enc = {4'h8, 11'b001_1111_1110};    4'ha: jpeg_dc_chrominance_huffman_enc = {4'h9, 11'b011_1111_1110};    4'hb: jpeg_dc_chrominance_huffman_enc = {4'ha, 11'b111_1111_1110};  endcaseendendfunction // jpeg_dc_chrominance_huffman_enc/*  J P E G _ A C _ L U M I N A N C E _ H U F F M A N _ E N C  ITU-T.81 annex K.3.2 Table K.5  This function translates the luminance AC (RunLength, Size) codepair  into the default huffman codeword.  Output is given as:  codelength[3:0]-1, codeword[15:0]  The codewords are right-alligned to ease bitstream generation.  example:  ac_luminance_run_length      = 3  ac_limunance_size (category) = 2  codelength = 8 +1 = 9  codeword   = 16'b0000_0001_1111_0111 => 9'b1_1111_0111*/function [19:0] jpeg_ac_luminance_huffman_enc;  input [ 3:0] run_length;  // category  input [ 3:0] size;begin  case( {run_length, size} ) // synopsys full_case parallel_case    8'h00: jpeg_ac_luminance_huffman_enc = {4'h3, 16'b0000_0000_0000_1010}; // EOB    8'h01: jpeg_ac_luminance_huffman_enc = {4'h1, 16'b0000_0000_0000_0000};    8'h02: jpeg_ac_luminance_huffman_enc = {4'h1, 16'b0000_0000_0000_0001};    8'h03: jpeg_ac_luminance_huffman_enc = {4'h2, 16'b0000_0000_0000_0100};    8'h04: jpeg_ac_luminance_huffman_enc = {4'h3, 16'b0000_0000_0000_1011};    8'h05: jpeg_ac_luminance_huffman_enc = {4'h4, 16'b0000_0000_0001_1010};    8'h06: jpeg_ac_luminance_huffman_enc = {4'h6, 16'b0000_0000_0111_1000};    8'h07: jpeg_ac_luminance_huffman_enc = {4'h7, 16'b0000_0000_1111_1000};    8'h08: jpeg_ac_luminance_huffman_enc = {4'h9, 16'b0000_0011_1111_0110};    8'h09: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1000_0010};    8'h0a: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1000_0011};    8'h11: jpeg_ac_luminance_huffman_enc = {4'h3, 16'b0000_0000_0000_1100};    8'h12: jpeg_ac_luminance_huffman_enc = {4'h4, 16'b0000_0000_0001_1011};    8'h13: jpeg_ac_luminance_huffman_enc = {4'h6, 16'b0000_0000_0111_1001};    8'h14: jpeg_ac_luminance_huffman_enc = {4'h8, 16'b0000_0001_1111_0110};    8'h15: jpeg_ac_luminance_huffman_enc = {4'ha, 16'b0000_0111_1111_0110};    8'h16: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1000_0100};    8'h17: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1000_0101};    8'h18: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1000_0110};    8'h19: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1000_0111};    8'h1a: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1000_1000};    8'h21: jpeg_ac_luminance_huffman_enc = {4'h4, 16'b0000_0000_0001_1100};    8'h22: jpeg_ac_luminance_huffman_enc = {4'h7, 16'b0000_0000_1111_1001};    8'h23: jpeg_ac_luminance_huffman_enc = {4'h9, 16'b0000_0011_1111_0111};    8'h24: jpeg_ac_luminance_huffman_enc = {4'hb, 16'b0000_1111_1111_0100};    8'h25: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1000_1001};    8'h26: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1000_1010};    8'h27: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1000_1011};    8'h28: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1000_1100};    8'h29: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1000_1101};    8'h2a: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1000_1110};    8'h31: jpeg_ac_luminance_huffman_enc = {4'h5, 16'b0000_0000_0011_1010};    8'h32: jpeg_ac_luminance_huffman_enc = {4'h8, 16'b0000_0001_1111_0111};    8'h33: jpeg_ac_luminance_huffman_enc = {4'hb, 16'b0000_1111_1111_0101};    8'h34: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1000_1111};    8'h35: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1001_0000};    8'h36: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1001_0001};    8'h37: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1001_0010};    8'h38: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1001_0011};    8'h39: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1001_0100};    8'h3a: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1001_0101};    8'h41: jpeg_ac_luminance_huffman_enc = {4'h5, 16'b0000_0000_0011_1011};    8'h42: jpeg_ac_luminance_huffman_enc = {4'h9, 16'b0000_0011_1111_1000};    8'h43: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1001_0110};    8'h44: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1001_0111};    8'h45: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1001_1000};    8'h46: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1001_1001};    8'h47: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1001_1010};    8'h48: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1001_1011};    8'h49: jpeg_ac_luminance_huffman_enc = {4'hf, 16'b1111_1111_1001_1100};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -