]> git.sesse.net Git - vlc/blob - plugins/idct/vdec_block.h
* Fixed the BeOS compile typo.
[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.2 2001/05/30 17:03:12 sam 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_mb->ppi_blocks[i_b],        \
51                                   p_mb->pi_sparse_pos[i_b] );           \
52                                                                         \
53             /*                                                          \
54              * Adding prediction and coefficient data (ISO/IEC 13818-2  \
55              * section 7.6.8)                                           \
56              */                                                         \
57             OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b],                     \
58                      p_mb->p_data[i_b], p_mb->i_addb_l_stride );        \
59         }                                                               \
60     }                                                                   \
61                                                                         \
62     /* chrominance */                                                   \
63     for( i_b = 4; i_b < 4 + p_mb->i_chroma_nb_blocks;                   \
64          i_b++, i_mask >>= 1 )                                          \
65     {                                                                   \
66         if( p_mb->i_coded_block_pattern & i_mask )                      \
67         {                                                               \
68             /*                                                          \
69              * Inverse DCT (ISO/IEC 13818-2 section Annex A)            \
70              */                                                         \
71             (p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b],        \
72                                   p_mb->pi_sparse_pos[i_b] );           \
73                                                                         \
74             /*                                                          \
75              * Adding prediction and coefficient data (ISO/IEC 13818-2  \
76              * section 7.6.8)                                           \
77              */                                                         \
78             OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b],                     \
79                      p_mb->p_data[i_b], p_mb->i_addb_c_stride );        \
80         }                                                               \
81     }                                                                   \
82 }
83
84 #define DECODEBLOCKSBW( OPBLOCK )                                       \
85 {                                                                       \
86     int             i_b, i_mask;                                        \
87                                                                         \
88     i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks);                       \
89                                                                         \
90     /* luminance */                                                     \
91     for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 )                        \
92     {                                                                   \
93         if( p_mb->i_coded_block_pattern & i_mask )                      \
94         {                                                               \
95             /*                                                          \
96              * Inverse DCT (ISO/IEC 13818-2 section Annex A)            \
97              */                                                         \
98             (p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b],        \
99                                   p_mb->pi_sparse_pos[i_b] );           \
100                                                                         \
101             /*                                                          \
102              * Adding prediction and coefficient data (ISO/IEC 13818-2  \
103              * section 7.6.8)                                           \
104              */                                                         \
105             OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b],                     \
106                      p_mb->p_data[i_b], p_mb->i_addb_l_stride );        \
107         }                                                               \
108     }                                                                   \
109 }
110