]> git.sesse.net Git - vlc/blob - plugins/idct/vdec_block.h
1c6c10bbafa35ed218339a835c0136fa8b1216bd
[vlc] / plugins / idct / vdec_block.h
1 /*****************************************************************************
2  * vdec_block_h: Macroblock copy functions
3  *****************************************************************************
4  * Copyright (C) 1999, 2000, 2001 VideoLAN
5  * $Id: vdec_block.h,v 1.3 2001/07/17 09:48:07 massiot Exp $
6  *
7  * Authors: Christophe Massiot <massiot@via.ecp.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  * 
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Prototypes
26  *****************************************************************************/
27 void _M( vdec_InitDecode )         ( struct vdec_thread_s *p_vdec );
28 void _M( vdec_DecodeMacroblockC )  ( struct vdec_thread_s *p_vdec,
29                                      struct macroblock_s * p_mb );
30 void _M( vdec_DecodeMacroblockBW ) ( struct vdec_thread_s *p_vdec,
31                                      struct macroblock_s * p_mb );
32         
33 /*****************************************************************************
34  * vdec_DecodeMacroblock : decode a macroblock of a picture
35  *****************************************************************************/
36 #define DECODEBLOCKSC( OPBLOCK )                                        \
37 {                                                                       \
38     int             i_b, i_mask;                                        \
39                                                                         \
40     i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks);                       \
41                                                                         \
42     /* luminance */                                                     \
43     for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 )                        \
44     {                                                                   \
45         if( p_mb->i_coded_block_pattern & i_mask )                      \
46         {                                                               \
47             /*                                                          \
48              * Inverse DCT (ISO/IEC 13818-2 section Annex A)            \
49              */                                                         \
50             (p_mb->pf_idct[i_b])( p_vdec->p_idct_data,                  \
51                                   p_mb->ppi_blocks[i_b],                \
52                                   p_mb->pi_sparse_pos[i_b] );           \
53                                                                         \
54             /*                                                          \
55              * Adding prediction and coefficient data (ISO/IEC 13818-2  \
56              * section 7.6.8)                                           \
57              */                                                         \
58             OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b],                     \
59                      p_mb->p_data[i_b], p_mb->i_addb_l_stride );        \
60         }                                                               \
61     }                                                                   \
62                                                                         \
63     /* chrominance */                                                   \
64     for( i_b = 4; i_b < 4 + p_mb->i_chroma_nb_blocks;                   \
65          i_b++, i_mask >>= 1 )                                          \
66     {                                                                   \
67         if( p_mb->i_coded_block_pattern & i_mask )                      \
68         {                                                               \
69             /*                                                          \
70              * Inverse DCT (ISO/IEC 13818-2 section Annex A)            \
71              */                                                         \
72             (p_mb->pf_idct[i_b])( p_vdec->p_idct_data,                  \
73                                   p_mb->ppi_blocks[i_b],                \
74                                   p_mb->pi_sparse_pos[i_b] );           \
75                                                                         \
76             /*                                                          \
77              * Adding prediction and coefficient data (ISO/IEC 13818-2  \
78              * section 7.6.8)                                           \
79              */                                                         \
80             OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b],                     \
81                      p_mb->p_data[i_b], p_mb->i_addb_c_stride );        \
82         }                                                               \
83     }                                                                   \
84 }
85
86 #define DECODEBLOCKSBW( OPBLOCK )                                       \
87 {                                                                       \
88     int             i_b, i_mask;                                        \
89                                                                         \
90     i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks);                       \
91                                                                         \
92     /* luminance */                                                     \
93     for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 )                        \
94     {                                                                   \
95         if( p_mb->i_coded_block_pattern & i_mask )                      \
96         {                                                               \
97             /*                                                          \
98              * Inverse DCT (ISO/IEC 13818-2 section Annex A)            \
99              */                                                         \
100             (p_mb->pf_idct[i_b])( p_vdec->p_idct_data,                  \
101                                   p_mb->ppi_blocks[i_b],                \
102                                   p_mb->pi_sparse_pos[i_b] );           \
103                                                                         \
104             /*                                                          \
105              * Adding prediction and coefficient data (ISO/IEC 13818-2  \
106              * section 7.6.8)                                           \
107              */                                                         \
108             OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b],                     \
109                      p_mb->p_data[i_b], p_mb->i_addb_l_stride );        \
110         }                                                               \
111     }                                                                   \
112 }
113