OpenCores
URL https://opencores.org/ocsvn/djpeg/djpeg/trunk

Subversion Repositories djpeg

[/] [djpeg/] [trunk/] [src/] [jpeg_decode.v] - Diff between revs 6 and 9

Show entire file | Details | Blame | View Log

Rev 6 Rev 9
Line 5... Line 5...
// Project     : JPEG Decoder
// Project     : JPEG Decoder
// Belong to   : 
// Belong to   : 
// Author      : H.Ishihara
// Author      : H.Ishihara
// E-Mail      : hidemi@sweetcafe.jp
// E-Mail      : hidemi@sweetcafe.jp
// HomePage    : http://www.sweetcafe.jp/
// HomePage    : http://www.sweetcafe.jp/
// Date        : 2007/04/11
// Date        : 2008/03/05
// Rev.        : 2.0
// Rev.        : 2.00
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Rev. Date       Description
// Rev. Date       Description
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// 1.01 2006/10/01 1st Release
// 1.01 2006/10/01 1st Release
// 1.02 2006/10/04 add ProcessIdle register
// 1.02 2006/10/04 add ProcessIdle register
// 2.00 2007/04/11 
// 1.99 2007/04/11 
 
// 2.00 2008/03/05 New Verion
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
`timescale 1ps / 1ps
`timescale 1ps / 1ps
 
 
module jpeg_decode
module jpeg_decode(
  (
 
   rst,
   rst,
   clk,
   clk,
 
 
   // From FIFO
   // From FIFO
   DataIn,
   DataIn,
Line 36... Line 36...
   OutPixelX,
   OutPixelX,
   OutPixelY,
   OutPixelY,
   OutR,
   OutR,
   OutG,
   OutG,
   OutB
   OutB
 
 
   );
   );
 
 
   input          rst;
   input          rst;
   input          clk;
   input          clk;
 
 
Line 68... Line 67...
   wire           UseByte;
   wire           UseByte;
   wire           UseWord;
   wire           UseWord;
 
 
   wire           ImageEnable;
   wire           ImageEnable;
   wire           EnableFF00;
   wire           EnableFF00;
   wire         DecodeFinish;
 
 
 
//   reg                  ProcessIdle;
//   reg                  ProcessIdle;
 
 
   //--------------------------------------------------------------------------
   //--------------------------------------------------------------------------
   // Read JPEG Data from FIFO
   // Read JPEG Data from FIFO
Line 89... Line 87...
                               // DataOut
                               // DataOut
                               .DataOut       ( JpegData            ),
                               .DataOut       ( JpegData            ),
                               .DataOutEnable ( JpegDataEnable      ),
                               .DataOutEnable ( JpegDataEnable      ),
 
 
                               //
                               //
                               .ImageEnable   ( EnableFF00          ),
        .ImageEnable    ( ImageEnable       ),
                                        .ProcessIdle    ( JpegDecodeIdle                ),
                                        .ProcessIdle    ( JpegDecodeIdle                ),
 
 
                               // UseData
                               // UseData
                               .UseBit        ( UseBit              ),
                               .UseBit        ( UseBit              ),
                               .UseWidth      ( UseWidth            ),
                               .UseWidth      ( UseWidth            ),
Line 113... Line 111...
   wire [1:0]      DhtTable;
   wire [1:0]      DhtTable;
   wire [7:0]      DhtCount;
   wire [7:0]      DhtCount;
   wire [7:0]      DhtData;
   wire [7:0]      DhtData;
 
 
   //
   //
   wire           HaffumanEnable;
    wire            HuffmanEnable;
   wire [1:0]      HaffumanTable;
    wire [1:0]      HuffmanTable;
   wire [3:0]      HaffumanCount;
    wire [3:0]      HuffmanCount;
   wire [15:0]     HaffumanData;
    wire [15:0]     HuffmanData;
   wire [7:0]      HaffumanStart;
    wire [7:0]      HuffmanStart;
 
 
   wire [11:0]     JpegBlockWidth;
   wire [11:0]     JpegBlockWidth;
 
 
   jpeg_decode_fsm u_jpeg_decode_fsm(
   jpeg_decode_fsm u_jpeg_decode_fsm(
                                     .rst(rst),
                                     .rst(rst),
Line 151... Line 149...
                                     .DhtTable        ( DhtTable        ),
                                     .DhtTable        ( DhtTable        ),
                                     .DhtCount        ( DhtCount        ),
                                     .DhtCount        ( DhtCount        ),
                                     .DhtData         ( DhtData         ),
                                     .DhtData         ( DhtData         ),
 
 
                                     //
                                     //
                                     .HaffumanEnable  ( HaffumanEnable  ),
        .HuffmanEnable  ( HuffmanEnable     ),
                                     .HaffumanTable   ( HaffumanTable   ),
        .HuffmanTable   ( HuffmanTable      ),
                                     .HaffumanCount   ( HaffumanCount   ),
        .HuffmanCount   ( HuffmanCount      ),
                                     .HaffumanData    ( HaffumanData    ),
        .HuffmanData    ( HuffmanData       ),
                                     .HaffumanStart   ( HaffumanStart   ),
        .HuffmanStart   ( HuffmanStart      ),
 
 
                                     //
                                     //
                                     .ImageEnable     ( ImageEnable     ),
                                     .ImageEnable     ( ImageEnable     ),
                                     .ImageEnd        ( DecodeFinish    ),
 
                                     .EnableFF00      ( EnableFF00      ),
 
 
 
                                     //
                                     //
                                     .UseByte         ( UseByte         ),
                                     .UseByte         ( UseByte         ),
                                     .UseWord         ( UseWord         )
                                     .UseWord         ( UseWord         )
                                     );
                                     );
 
 
 
 
   wire           HmDecEnable;
   wire           HmDecEnable;
   wire [2:0]     HmDecColor;
   wire [2:0]     HmDecColor;
 
    wire            HmRead;
 
    wire [4:0]      HmAddress;
 
 
   wire           HmDecSel;
    wire [15:0]     HmDataA, HmDataB;
   wire           HmDecRelease;
 
 
 
   wire [15:0]    Hm00Data;
 
   wire [15:0]    Hm01Data;
 
   wire [15:0]    Hm02Data;
 
   wire [15:0]    Hm03Data;
 
   wire [15:0]    Hm04Data;
 
   wire [15:0]    Hm05Data;
 
   wire [15:0]    Hm06Data;
 
   wire [15:0]    Hm07Data;
 
   wire [15:0]    Hm08Data;
 
   wire [15:0]    Hm09Data;
 
   wire [15:0]    Hm10Data;
 
   wire [15:0]    Hm11Data;
 
   wire [15:0]    Hm12Data;
 
   wire [15:0]    Hm13Data;
 
   wire [15:0]    Hm14Data;
 
   wire [15:0]    Hm15Data;
 
   wire [15:0]    Hm16Data;
 
   wire [15:0]    Hm17Data;
 
   wire [15:0]    Hm18Data;
 
   wire [15:0]    Hm19Data;
 
   wire [15:0]    Hm20Data;
 
   wire [15:0]    Hm21Data;
 
   wire [15:0]    Hm22Data;
 
   wire [15:0]    Hm23Data;
 
   wire [15:0]    Hm24Data;
 
   wire [15:0]    Hm25Data;
 
   wire [15:0]    Hm26Data;
 
   wire [15:0]    Hm27Data;
 
   wire [15:0]    Hm28Data;
 
   wire [15:0]    Hm29Data;
 
   wire [15:0]    Hm30Data;
 
   wire [15:0]    Hm31Data;
 
   wire [15:0]    Hm32Data;
 
   wire [15:0]    Hm33Data;
 
   wire [15:0]    Hm34Data;
 
   wire [15:0]    Hm35Data;
 
   wire [15:0]    Hm36Data;
 
   wire [15:0]    Hm37Data;
 
   wire [15:0]    Hm38Data;
 
   wire [15:0]    Hm39Data;
 
   wire [15:0]    Hm40Data;
 
   wire [15:0]    Hm41Data;
 
   wire [15:0]    Hm42Data;
 
   wire [15:0]    Hm43Data;
 
   wire [15:0]    Hm44Data;
 
   wire [15:0]    Hm45Data;
 
   wire [15:0]    Hm46Data;
 
   wire [15:0]    Hm47Data;
 
   wire [15:0]    Hm48Data;
 
   wire [15:0]    Hm49Data;
 
   wire [15:0]    Hm50Data;
 
   wire [15:0]    Hm51Data;
 
   wire [15:0]    Hm52Data;
 
   wire [15:0]    Hm53Data;
 
   wire [15:0]    Hm54Data;
 
   wire [15:0]    Hm55Data;
 
   wire [15:0]    Hm56Data;
 
   wire [15:0]    Hm57Data;
 
   wire [15:0]    Hm58Data;
 
   wire [15:0]    Hm59Data;
 
   wire [15:0]    Hm60Data;
 
   wire [15:0]    Hm61Data;
 
   wire [15:0]    Hm62Data;
 
   wire [15:0]    Hm63Data;
 
 
 
   wire           DctIdle;
 
 
 
   jpeg_haffuman u_jpeg_haffuman(
    jpeg_huffman u_jpeg_huffman(
                                 .rst(rst),
                                 .rst(rst),
                                 .clk(clk),
                                 .clk(clk),
 
 
 
        .ProcessInit        ( JpegDecodeIdle    ),
 
 
                                 // DQT Table
                                 // DQT Table
                                 .DqtInEnable ( DqtEnable ),
                                 .DqtInEnable ( DqtEnable ),
                                 .DqtInColor  ( DqtTable ),
                                 .DqtInColor  ( DqtTable ),
                                 .DqtInCount  ( DqtCount[5:0] ),
                                 .DqtInCount  ( DqtCount[5:0] ),
                                 .DqtInData   ( DqtData ),
                                 .DqtInData   ( DqtData ),
Line 257... Line 190...
                                 .DhtInEnable ( DhtEnable ),
                                 .DhtInEnable ( DhtEnable ),
                                 .DhtInColor  ( DhtTable  ),
                                 .DhtInColor  ( DhtTable  ),
                                 .DhtInCount  ( DhtCount  ),
                                 .DhtInCount  ( DhtCount  ),
                                 .DhtInData   ( DhtData   ),
                                 .DhtInData   ( DhtData   ),
 
 
                                 // Haffuman Table   
        // Huffman Table   
                                 .HaffumanTableEnable ( HaffumanEnable ),
        .HuffmanTableEnable ( HuffmanEnable     ),
                                 .HaffumanTableColor  ( HaffumanTable  ),
        .HuffmanTableColor  ( HuffmanTable      ),
                                 .HaffumanTableCount  ( HaffumanCount  ),
        .HuffmanTableCount  ( HuffmanCount      ),
                                 .HaffumanTableCode   ( HaffumanData   ),
        .HuffmanTableCode   ( HuffmanData       ),
                                 .HaffumanTableStart  ( HaffumanStart  ),
        .HuffmanTableStart  ( HuffmanStart      ),
 
 
                                 // Haffuman Decode
        // Huffman Decode
                                 .DataInRun      ( ImageEnable    ),
                                 .DataInRun      ( ImageEnable    ),
                                 .DataInEnable   ( JpegDataEnable ),
                                 .DataInEnable   ( JpegDataEnable ),
                                 .DataIn         ( JpegData       ),
                                 .DataIn         ( JpegData       ),
 
 
                                 // Output decode data   
                                 // Output decode data   
                                 .DecodeUseBit   ( UseBit       ),
                                 .DecodeUseBit   ( UseBit       ),
                                 .DecodeUseWidth ( UseWidth     ),
                                 .DecodeUseWidth ( UseWidth     ),
 
 
                                 // Data Out
                                 // Data Out
                                 .DataOutIdle   ( DctIdle     ),
 
                                 .DataOutEnable ( HmDecEnable ),
                                 .DataOutEnable ( HmDecEnable ),
 
        .DataOutRead        ( HmRead            ),
 
        .DataOutAddress     ( HmAddress         ),
                                 .DataOutColor  ( HmDecColor  ),
                                 .DataOutColor  ( HmDecColor  ),
                                 .DataOutSel    ( HmDecSel    ),
        .DataOutA           ( HmDataA           ),
                                 .Data00Reg    ( Hm00Data ),
        .DataOutB           ( HmDataB           )
                                 .Data01Reg    ( Hm01Data ),
 
                                 .Data02Reg    ( Hm02Data ),
 
                                 .Data03Reg    ( Hm03Data ),
 
                                 .Data04Reg    ( Hm04Data ),
 
                                 .Data05Reg    ( Hm05Data ),
 
                                 .Data06Reg    ( Hm06Data ),
 
                                 .Data07Reg    ( Hm07Data ),
 
                                 .Data08Reg    ( Hm08Data ),
 
                                 .Data09Reg    ( Hm09Data ),
 
                                 .Data10Reg    ( Hm10Data ),
 
                                 .Data11Reg    ( Hm11Data ),
 
                                 .Data12Reg    ( Hm12Data ),
 
                                 .Data13Reg    ( Hm13Data ),
 
                                 .Data14Reg    ( Hm14Data ),
 
                                 .Data15Reg    ( Hm15Data ),
 
                                 .Data16Reg    ( Hm16Data ),
 
                                 .Data17Reg    ( Hm17Data ),
 
                                 .Data18Reg    ( Hm18Data ),
 
                                 .Data19Reg    ( Hm19Data ),
 
                                 .Data20Reg    ( Hm20Data ),
 
                                 .Data21Reg    ( Hm21Data ),
 
                                 .Data22Reg    ( Hm22Data ),
 
                                 .Data23Reg    ( Hm23Data ),
 
                                 .Data24Reg    ( Hm24Data ),
 
                                 .Data25Reg    ( Hm25Data ),
 
                                 .Data26Reg    ( Hm26Data ),
 
                                 .Data27Reg    ( Hm27Data ),
 
                                 .Data28Reg    ( Hm28Data ),
 
                                 .Data29Reg    ( Hm29Data ),
 
                                 .Data30Reg    ( Hm30Data ),
 
                                 .Data31Reg    ( Hm31Data ),
 
                                 .Data32Reg    ( Hm32Data ),
 
                                 .Data33Reg    ( Hm33Data ),
 
                                 .Data34Reg    ( Hm34Data ),
 
                                 .Data35Reg    ( Hm35Data ),
 
                                 .Data36Reg    ( Hm36Data ),
 
                                 .Data37Reg    ( Hm37Data ),
 
                                 .Data38Reg    ( Hm38Data ),
 
                                 .Data39Reg    ( Hm39Data ),
 
                                 .Data40Reg    ( Hm40Data ),
 
                                 .Data41Reg    ( Hm41Data ),
 
                                 .Data42Reg    ( Hm42Data ),
 
                                 .Data43Reg    ( Hm43Data ),
 
                                 .Data44Reg    ( Hm44Data ),
 
                                 .Data45Reg    ( Hm45Data ),
 
                                 .Data46Reg    ( Hm46Data ),
 
                                 .Data47Reg    ( Hm47Data ),
 
                                 .Data48Reg    ( Hm48Data ),
 
                                 .Data49Reg    ( Hm49Data ),
 
                                 .Data50Reg    ( Hm50Data ),
 
                                 .Data51Reg    ( Hm51Data ),
 
                                 .Data52Reg    ( Hm52Data ),
 
                                 .Data53Reg    ( Hm53Data ),
 
                                 .Data54Reg    ( Hm54Data ),
 
                                 .Data55Reg    ( Hm55Data ),
 
                                 .Data56Reg    ( Hm56Data ),
 
                                 .Data57Reg    ( Hm57Data ),
 
                                 .Data58Reg    ( Hm58Data ),
 
                                 .Data59Reg    ( Hm59Data ),
 
                                 .Data60Reg    ( Hm60Data ),
 
                                 .Data61Reg    ( Hm61Data ),
 
                                 .Data62Reg    ( Hm62Data ),
 
                                 .Data63Reg    ( Hm63Data ),
 
                                 .DataOutRelease (HmDecRelase)
 
                                 );
                                 );
 
 
   wire           DctEnable;
   wire           DctEnable;
   wire [2:0]     DctColor;
   wire [2:0]     DctColor;
   wire [2:0]     DctPage;
   wire [2:0]     DctPage;
   wire [1:0]     DctCount;
   wire [1:0]     DctCount;
   wire [8:0]     Dct0Data;
    wire [8:0]      Dct0Data, Dct1Data;
   wire [8:0]     Dct1Data;
 
 
 
   wire [15:0]    DctWidth;
    wire [15:0]     DctWidth, DctHeight;
   wire [15:0]    DctHeight;
    wire [11:0]     DctBlockX, DctBlockY;
   wire [11:0]    DctBlockX;
 
   wire [11:0]    DctBlockY;
 
 
 
   wire           YCbCrIdle;
   wire           YCbCrIdle;
 
 
   jpeg_idct u_jpeg_idct(
   jpeg_idct u_jpeg_idct(
                         .rst(rst),
                         .rst(rst),
                         .clk(clk),
                         .clk(clk),
 
 
 
        .ProcessInit    ( JpegDecodeIdle    ),
 
 
                         .DataInEnable( HmDecEnable ),
                         .DataInEnable( HmDecEnable ),
                         .DataInSel( HmDecSel ),
        .DataInRead     ( HmRead        ),
                         .Data00In( Hm00Data ),
        .DataInAddress  ( HmAddress     ),
                         .Data01In( Hm01Data ),
        .DataInA        ( HmDataA       ),
                         .Data02In( Hm02Data ),
        .DataInB        ( HmDataB       ),
                         .Data03In( Hm03Data ),
 
                         .Data04In( Hm04Data ),
 
                         .Data05In( Hm05Data ),
 
                         .Data06In( Hm06Data ),
 
                         .Data07In( Hm07Data ),
 
                         .Data08In( Hm08Data ),
 
                         .Data09In( Hm09Data ),
 
                         .Data10In( Hm10Data ),
 
                         .Data11In( Hm11Data ),
 
                         .Data12In( Hm12Data ),
 
                         .Data13In( Hm13Data ),
 
                         .Data14In( Hm14Data ),
 
                         .Data15In( Hm15Data ),
 
                         .Data16In( Hm16Data ),
 
                         .Data17In( Hm17Data ),
 
                         .Data18In( Hm18Data ),
 
                         .Data19In( Hm19Data ),
 
                         .Data20In( Hm20Data ),
 
                         .Data21In( Hm21Data ),
 
                         .Data22In( Hm22Data ),
 
                         .Data23In( Hm23Data ),
 
                         .Data24In( Hm24Data ),
 
                         .Data25In( Hm25Data ),
 
                         .Data26In( Hm26Data ),
 
                         .Data27In( Hm27Data ),
 
                         .Data28In( Hm28Data ),
 
                         .Data29In( Hm29Data ),
 
                         .Data30In( Hm30Data ),
 
                         .Data31In( Hm31Data ),
 
                         .Data32In( Hm32Data ),
 
                         .Data33In( Hm33Data ),
 
                         .Data34In( Hm34Data ),
 
                         .Data35In( Hm35Data ),
 
                         .Data36In( Hm36Data ),
 
                         .Data37In( Hm37Data ),
 
                         .Data38In( Hm38Data ),
 
                         .Data39In( Hm39Data ),
 
                         .Data40In( Hm40Data ),
 
                         .Data41In( Hm41Data ),
 
                         .Data42In( Hm42Data ),
 
                         .Data43In( Hm43Data ),
 
                         .Data44In( Hm44Data ),
 
                         .Data45In( Hm45Data ),
 
                         .Data46In( Hm46Data ),
 
                         .Data47In( Hm47Data ),
 
                         .Data48In( Hm48Data ),
 
                         .Data49In( Hm49Data ),
 
                         .Data50In( Hm50Data ),
 
                         .Data51In( Hm51Data ),
 
                         .Data52In( Hm52Data ),
 
                         .Data53In( Hm53Data ),
 
                         .Data54In( Hm54Data ),
 
                         .Data55In( Hm55Data ),
 
                         .Data56In( Hm56Data ),
 
                         .Data57In( Hm57Data ),
 
                         .Data58In( Hm58Data ),
 
                         .Data59In( Hm59Data ),
 
                         .Data60In( Hm60Data ),
 
                         .Data61In( Hm61Data ),
 
                         .Data62In( Hm62Data ),
 
                         .Data63In( Hm63Data ),
 
                         .DataInIdle( DctIdle ),
 
                         .DataInRelease( HmDecRelase ),
 
 
 
                         .DataOutEnable ( DctEnable ),
                         .DataOutEnable ( DctEnable ),
                         .DataOutPage   ( DctPage   ),
                         .DataOutPage   ( DctPage   ),
                         .DataOutCount  ( DctCount  ),
                         .DataOutCount  ( DctCount  ),
                         .Data0Out      ( Dct0Data  ),
                         .Data0Out      ( Dct0Data  ),
Line 446... Line 252...
        wire [7:0]       ColorR, ColorG, ColorB;
        wire [7:0]       ColorR, ColorG, ColorB;
   jpeg_ycbcr u_jpeg_ycbcr(
   jpeg_ycbcr u_jpeg_ycbcr(
                           .rst(rst),
                           .rst(rst),
                           .clk(clk),
                           .clk(clk),
 
 
 
        .ProcessInit        ( JpegDecodeIdle    ),
 
 
                           .DataInEnable     ( DctEnable ),
                           .DataInEnable     ( DctEnable ),
                           .DataInPage       ( DctPage   ),
                           .DataInPage       ( DctPage   ),
                           .DataInCount      ( DctCount  ),
                           .DataInCount      ( DctCount  ),
                           .DataInIdle       ( YCbCrIdle ),
                           .DataInIdle       ( YCbCrIdle ),
                           .Data0In          ( Dct0Data  ),
                           .Data0In          ( Dct0Data  ),
Line 469... Line 277...
        assign OutPixelY        = (ImageEnable)?ColorPixelY:16'd0;
        assign OutPixelY        = (ImageEnable)?ColorPixelY:16'd0;
        assign OutR                     = (ImageEnable)?ColorR:8'd0;
        assign OutR                     = (ImageEnable)?ColorR:8'd0;
        assign OutG                     = (ImageEnable)?ColorG:8'd0;
        assign OutG                     = (ImageEnable)?ColorG:8'd0;
        assign OutB                     = (ImageEnable)?ColorB:8'd0;
        assign OutB                     = (ImageEnable)?ColorB:8'd0;
 
 
endmodule // jpeg_decode
endmodule
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.