Add Russian translation provided by Валерий Крувялис <valkru@mail.ru>
[xiph-mirror.git] / theora-fpga / testbenchs / expandblock / reconpixelindex.vhd
blob0682dd61d522e3289721372959534937347f7ab6
1 library std;
2 library ieee;
3 use ieee.std_logic_1164.all;
4 use ieee.numeric_std.all;
6 entity ReconPixelIndex is
8 generic (
9 RPI_POS_WIDTH : positive := 17;
10 HV_FRAG_WIDTH : positive := 8;
11 Y_STRIDE_WIDTH : positive := 12;
12 UV_STRIDE_WIDTH : positive := 11;
13 Y_PL_FRAG_WIDTH : positive := 21;
14 UV_PL_FRAG_WIDTH : positive := 19;
15 RECON_Y_DATA_OFS_WIDTH : positive := 20;
16 RECON_UV_DATA_OFS_WIDTH : positive := 20
20 port (
21 rpi_position : in unsigned(RPI_POS_WIDTH-1 downto 0);
22 HFragments : in unsigned(HV_FRAG_WIDTH-1 downto 0);
23 VFragments : in unsigned(HV_FRAG_WIDTH-1 downto 0);
24 YStride : in unsigned(Y_STRIDE_WIDTH-1 downto 0);
25 UVStride : in unsigned(UV_STRIDE_WIDTH-1 downto 0);
26 YPlaneFragments : in unsigned(Y_PL_FRAG_WIDTH-1 downto 0);
27 UVPlaneFragments : in unsigned(UV_PL_FRAG_WIDTH-1 downto 0);
28 ReconYDataOffset : in unsigned(RECON_Y_DATA_OFS_WIDTH-1 downto 0);
29 ReconUDataOffset : in unsigned(RECON_UV_DATA_OFS_WIDTH-1 downto 0);
30 ReconVDataOffset : in unsigned(RECON_UV_DATA_OFS_WIDTH-1 downto 0);
32 rpi_value : out signed(31 downto 0)
34 end ReconPixelIndex;
36 architecture a_ReconPixelIndex of ReconPixelIndex is
37 constant VFRAGPIXELS : unsigned(3 downto 0) := x"8";
38 constant HFRAGPIXELS : unsigned(3 downto 0) := x"8";
40 begin -- a_ReconPixelIndex
42 rpi_value <=
43 resize(
44 signed(
46 ((rpi_position / HFragments) * VFRAGPIXELS * YStride) +
47 ((rpi_position mod HFragments) * HFRAGPIXELS) +
48 ReconYDataOffset), 32)
49 when rpi_position < YPlaneFragments else
50 resize(
51 signed(
52 (((rpi_position - YPlaneFragments) / SHIFT_RIGHT(HFragments, 1)) * VFRAGPIXELS * UVStride) +
53 (((rpi_position - YPlaneFragments) mod SHIFT_RIGHT(HFragments, 1)) * HFRAGPIXELS) +
54 ReconUDataOffset), 32)
55 when rpi_position < YPlaneFragments + UVPlaneFragments else
56 resize(
57 signed(
58 (((rpi_position - (YPlaneFragments + UVPlaneFragments))/ SHIFT_RIGHT(HFragments, 1)) * VFRAGPIXELS * UVStride) +
59 (((rpi_position - (YPlaneFragments + UVPlaneFragments)) mod SHIFT_RIGHT(HFragments, 1)) * HFRAGPIXELS) +
60 ReconVDataOffset), 32);
62 end a_ReconPixelIndex;