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

Subversion Repositories mkjpeg

[/] [mkjpeg/] [trunk/] [design/] [common/] [JPEG_PKG.vhd] - Blame information for rev 71

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 25 mikel262
--------------------------------------------------------------------------------
2
--                                                                            --
3
--                          V H D L    F I L E                                --
4
--                          COPYRIGHT (C) 2009                                --
5
--                                                                            --
6
--------------------------------------------------------------------------------
7
--
8
-- Title       : JPEG_PKG
9
-- Design      : JPEG_ENC
10
-- Author      : Michal Krepa
11
--
12
--------------------------------------------------------------------------------
13
--
14
-- File        : JPEG_PKG.VHD
15
-- Created     : Sat Mar 7 2009
16
--
17
--------------------------------------------------------------------------------
18
--
19
--  Description : Package for JPEG core
20
--
21
--------------------------------------------------------------------------------
22
 
23
library IEEE;
24
  use IEEE.STD_LOGIC_1164.all;
25
  use ieee.numeric_std.all;
26
 
27
package JPEG_PKG is
28
 
29
  -- do not change, constant
30 36 mikel262
  constant C_HDR_SIZE         : integer := 623;
31 25 mikel262
 
32
  -- warning! this parameter heavily affects memory size required
33
  -- if expected image width is known change this parameter to match this
34
  -- otherwise some onchip RAM will be wasted and never used
35 67 mikel262
  constant C_MAX_LINE_WIDTH   : integer := 640;
36 28 mikel262
 
37 56 mikel262
  -- memory/performance tradeoff
38
  -- 8 extra lines highest performance
39
  -- 0 extra lines lowest area
40 67 mikel262
  --constant C_EXTRA_LINES  : integer := 0; -- from 0 to 8
41 56 mikel262
 
42
 
43 63 mikel262
  -- 24 bit format RGB/YCbCr 888 bits
44
  -- 16 bit format RGB/YCbCr 565 bits
45 52 mikel262
  constant C_PIXEL_BITS    : integer := 24;
46 49 mikel262
 
47 63 mikel262
  -- 0 = RGB
48
  -- 1 = YUV/YCbCr
49
  constant C_YUV_INPUT  : std_logic := '0';
50
 
51 25 mikel262
  type T_SM_SETTINGS is record
52
    x_cnt               : unsigned(15 downto 0);
53
    y_cnt               : unsigned(15 downto 0);
54 61 mikel262
    cmp_idx             : unsigned(2 downto 0);
55 25 mikel262
  end record;
56
 
57
  constant C_SM_SETTINGS : T_SM_SETTINGS :=
58
  (
59
    (others => '0'),
60
    (others => '0'),
61
    (others => '0')
62
  );
63
 
64
  function log2(n : natural) return natural;
65
 
66
end package JPEG_PKG;
67
 
68
package body JPEG_PKG is
69
 
70
  -----------------------------------------------------------------------------
71
  function log2(n : natural)
72
  return natural is
73
  begin
74
    for i in 0 to 31 loop
75
      if (2**i) >= n then
76
        return i;
77
      end if;
78
    end loop;
79
    return 32;
80
  end log2;
81
  -----------------------------------------------------------------------------
82
 
83
end package body JPEG_PKG;

powered by: WebSVN 2.1.0

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