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

Subversion Repositories mkjpeg

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

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 58 mikel262
  constant C_MAX_LINE_WIDTH   : integer := 1280;
36 28 mikel262
 
37 56 mikel262
  -- memory/performance tradeoff
38
  -- 8 extra lines highest performance
39
  -- 0 extra lines lowest area
40
  constant C_EXTRA_LINES  : integer := 8; -- from 0 to 8
41
 
42
 
43 49 mikel262
  -- 24 bit format RGB 888 bits
44
  -- 16 bit format RGB 565 bits
45 52 mikel262
  constant C_PIXEL_BITS    : integer := 24;
46 49 mikel262
 
47 25 mikel262
  type T_SM_SETTINGS is record
48
    x_cnt               : unsigned(15 downto 0);
49
    y_cnt               : unsigned(15 downto 0);
50 61 mikel262
    cmp_idx             : unsigned(2 downto 0);
51 25 mikel262
  end record;
52
 
53
  constant C_SM_SETTINGS : T_SM_SETTINGS :=
54
  (
55
    (others => '0'),
56
    (others => '0'),
57
    (others => '0')
58
  );
59
 
60
  function log2(n : natural) return natural;
61
 
62
end package JPEG_PKG;
63
 
64
package body JPEG_PKG is
65
 
66
  -----------------------------------------------------------------------------
67
  function log2(n : natural)
68
  return natural is
69
  begin
70
    for i in 0 to 31 loop
71
      if (2**i) >= n then
72
        return i;
73
      end if;
74
    end loop;
75
    return 32;
76
  end log2;
77
  -----------------------------------------------------------------------------
78
 
79
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.