summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/m4v_h263/dec/src/motion_comp.h
blob: 0c12f201aea7e0e16880ef545fe367e001b5f784 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* ------------------------------------------------------------------
 * Copyright (C) 1998-2009 PacketVideo
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 * -------------------------------------------------------------------
 */
#ifndef motion_comp_h
#define motion_comp_h

/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "mp4dec_lib.h"

/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/* CBP Mask defines used in chrominance prediction */
#define CBP_MASK_CHROMA_BLK4    0x2
#define CBP_MASK_CHROMA_BLK5    0x1

/* CBP Mask defines used in luminance prediction (MODE_INTER4V) */
#define CBP_MASK_BLK0_MODE_INTER4V  0x20
#define CBP_MASK_BLK1_MODE_INTER4V  0x10
#define CBP_MASK_BLK2_MODE_INTER4V  0x08
#define CBP_MASK_BLK3_MODE_INTER4V  0x04

/* CBP Mask defines used in luminance prediction (MODE_INTER or MODE_INTER_Q) */
#define CBP_MASK_MB_MODE_INTER  0x3c

/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif

#define CLIP_RESULT(x)      if(x & -256){x = 0xFF & (~(x>>31));}
#define ADD_AND_CLIP1(x)    x += (pred_word&0xFF); CLIP_RESULT(x);
#define ADD_AND_CLIP2(x)    x += ((pred_word>>8)&0xFF); CLIP_RESULT(x);
#define ADD_AND_CLIP3(x)    x += ((pred_word>>16)&0xFF); CLIP_RESULT(x);
#define ADD_AND_CLIP4(x)    x += ((pred_word>>24)&0xFF); CLIP_RESULT(x);

#define ADD_AND_CLIP(x,y)    {  x9 = ~(x>>8); \
                            if(x9!=-1){ \
                                x9 = ((uint32)x9)>>24; \
                                y = x9|(y<<8); \
                            } \
                            else \
                            {    \
                                y =  x|(y<<8); \
                            } \
                            }


    static int (*const GetPredAdvBTable[2][2])(uint8*, uint8*, int, int) =
    {
        {&GetPredAdvancedBy0x0, &GetPredAdvancedBy0x1},
        {&GetPredAdvancedBy1x0, &GetPredAdvancedBy1x1}
    };

    /*----------------------------------------------------------------------------
    ; SIMPLE TYPEDEF'S
    ----------------------------------------------------------------------------*/

    /*----------------------------------------------------------------------------
    ; ENUMERATED TYPEDEF'S
    ----------------------------------------------------------------------------*/

    /*----------------------------------------------------------------------------
    ; STRUCTURES TYPEDEF'S
    ----------------------------------------------------------------------------*/

    /*----------------------------------------------------------------------------
    ; GLOBAL FUNCTION DEFINITIONS
    ; Function Prototype declaration
    ----------------------------------------------------------------------------*/

    /*----------------------------------------------------------------------------
    ; END
    ----------------------------------------------------------------------------*/
#endif

#ifdef __cplusplus
}
#endif