~ubuntu-branches/ubuntu/natty/x264/natty

« back to all changes in this revision

Viewing changes to common/clip1.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2006-02-14 12:51:13 UTC
  • Revision ID: james.westby@ubuntu.com-20060214125113-t2vdkiqgcctz9ndd
Tags: upstream-0.cvs20060210
ImportĀ upstreamĀ versionĀ 0.cvs20060210

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 * clip1.h: h264 encoder library
 
3
 *****************************************************************************
 
4
 * Copyright (C) 2003 Laurent Aimar
 
5
 * $Id: clip1.h,v 1.1 2004/06/03 19:27:06 fenrir Exp $
 
6
 *
 
7
 * Authors: Laurent Aimar <fenrir@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
#ifndef _CLIP1_H
 
25
#define _CLIP1_H 1
 
26
 
 
27
/* Clip1 table
 
28
 * XXX : only for tap filter.
 
29
 *
 
30
 * With tap filter (( 1, -5, 20, 20, -5, 1 ) + 16 )/ 32
 
31
 * -> (-2*5 * 255+16)/32 <= out <= (2*1*255 + 2*20*255+16)/32
 
32
 * -> -80 <= out <= 335
 
33
 * So we need a table of 80+335+1 = 416 entries
 
34
 */
 
35
 
 
36
static const uint8_t x264_mc_clip1_table[80+1+335] =
 
37
{
 
38
    /* -80 -> -1 */
 
39
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 
40
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 
41
    0,0,0,0,0,0,
 
42
    /* 0 -> 255 */
 
43
    0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15, 16, 17,
 
44
    18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
 
45
    36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
 
46
    54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
 
47
    72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
 
48
    90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,101,102,103,104,105,106,107,
 
49
    108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,
 
50
    126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
 
51
    144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,
 
52
    162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,
 
53
    180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,
 
54
    198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,
 
55
    216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,
 
56
    234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,
 
57
    252,253,254,255,
 
58
    /* 256 -> 340 */
 
59
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 
60
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 
61
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 
62
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 
63
    255,255,255,255,255,255,255,255,
 
64
};
 
65
 
 
66
static inline uint8_t x264_mc_clip1( int x )
 
67
{
 
68
    return x264_mc_clip1_table[x+80];
 
69
}
 
70
 
 
71
static inline uint8_t x264_clip_uint8( int x )
 
72
{
 
73
    return x&(~255) ? (-x)>>31 : x;
 
74
}
 
75
 
 
76
#endif