~medibuntu-maintainers/mplayer/medibuntu.quantal

« back to all changes in this revision

Viewing changes to ffmpeg/libavcodec/motionpixels_tablegen.h

  • Committer: Gauvain Pocentek
  • Date: 2011-08-21 07:22:23 UTC
  • mfrom: (66.1.11 oneiric)
  • Revision ID: gauvain@pocentek.net-20110821072223-ummeossdz7okpb3d
* Merge from Ubuntu:
  - put back faac support
  - recommends apport-hooks-medibuntu
  - change Maintainer, Uploaders & Vcs-* fields.
* New upstream snapshot
  - update 23mplayer-debug-printf.patch
  - fixes miscompilation with gcc 4.6, Closes: #623304
  - improved internal mkv demuxer, Closes: #595452
  - Fixed segfault due to missing sanitation on playlist files,
    Closes: #591525
  - Fixed byteorder on 16-bit displays, Closes: #594093
  - tighten build depends on libav
  - --enable-largefile switch has been dropped
  - add build dependency on yasm
* Fix build dependency on libjpeg-dev, Closes: #634277
* rewrite debian/copyright in DEP5 format
* fix clean target
* don't remove snapshot_version file
* enable XVID, MP3 and X264 encoders
* simply architecture specific dependencies, Closes: #634773
* make buildlogs verbose
* unbreak building mplayer-doc package
* don't fail debian package build if not all shlibdeps information could be retrieved
* update configure flags for static libav* libraries
* fix spelling in mplayer-dbg description, Closes: #617826
* enable blueray support, Closes: #577761
* Select oss as default audio output module on kFreeBSD, Closes: #598431
* Update documentation with regard to our modifications to the upstream tarball.
* really no longer build mplayer-gui, Closes: #612473
* simplify/remove instruction to get upstream sources
* normalize debian/{control,copyright,mplayer.install} with wrap-and-sort
* bump standards version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Header file for hardcoded motionpixels RGB to YUV table
 
3
 *
 
4
 * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
 
5
 *
 
6
 * This file is part of Libav.
 
7
 *
 
8
 * Libav is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU Lesser General Public
 
10
 * License as published by the Free Software Foundation; either
 
11
 * version 2.1 of the License, or (at your option) any later version.
 
12
 *
 
13
 * Libav is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * Lesser General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU Lesser General Public
 
19
 * License along with Libav; if not, write to the Free Software
 
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
21
 */
 
22
 
 
23
#ifndef AVCODEC_MOTIONPIXELS_TABLEGEN_H
 
24
#define AVCODEC_MOTIONPIXELS_TABLEGEN_H
 
25
 
 
26
#include <stdint.h>
 
27
 
 
28
typedef struct YuvPixel {
 
29
    int8_t y, v, u;
 
30
} YuvPixel;
 
31
 
 
32
static int mp_yuv_to_rgb(int y, int v, int u, int clip_rgb) {
 
33
    static const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
 
34
    int r, g, b;
 
35
 
 
36
    r = (1000 * y + 701 * v) / 1000;
 
37
    g = (1000 * y - 357 * v - 172 * u) / 1000;
 
38
    b = (1000 * y + 886 * u) / 1000;
 
39
    if (clip_rgb)
 
40
        return ((cm[r * 8] & 0xF8) << 7) | ((cm[g * 8] & 0xF8) << 2) | (cm[b * 8] >> 3);
 
41
    if ((unsigned)r < 32 && (unsigned)g < 32 && (unsigned)b < 32)
 
42
        return (r << 10) | (g << 5) | b;
 
43
    return 1 << 15;
 
44
}
 
45
 
 
46
#if CONFIG_HARDCODED_TABLES
 
47
#define motionpixels_tableinit()
 
48
#include "libavcodec/motionpixels_tables.h"
 
49
#else
 
50
static YuvPixel mp_rgb_yuv_table[1 << 15];
 
51
 
 
52
static void mp_set_zero_yuv(YuvPixel *p)
 
53
{
 
54
    int i, j;
 
55
 
 
56
    for (i = 0; i < 31; ++i) {
 
57
        for (j = 31; j > i; --j)
 
58
            if (!(p[j].u | p[j].v | p[j].y))
 
59
                p[j] = p[j - 1];
 
60
        for (j = 0; j < 31 - i; ++j)
 
61
            if (!(p[j].u | p[j].v | p[j].y))
 
62
                p[j] = p[j + 1];
 
63
    }
 
64
}
 
65
 
 
66
static void mp_build_rgb_yuv_table(YuvPixel *p)
 
67
{
 
68
    int y, v, u, i;
 
69
 
 
70
    for (y = 0; y <= 31; ++y)
 
71
        for (v = -31; v <= 31; ++v)
 
72
            for (u = -31; u <= 31; ++u) {
 
73
                i = mp_yuv_to_rgb(y, v, u, 0);
 
74
                if (i < (1 << 15) && !(p[i].u | p[i].v | p[i].y)) {
 
75
                    p[i].y = y;
 
76
                    p[i].v = v;
 
77
                    p[i].u = u;
 
78
                }
 
79
            }
 
80
    for (i = 0; i < 1024; ++i)
 
81
        mp_set_zero_yuv(p + i * 32);
 
82
}
 
83
 
 
84
static void motionpixels_tableinit(void)
 
85
{
 
86
    if (!mp_rgb_yuv_table[0].u)
 
87
        mp_build_rgb_yuv_table(mp_rgb_yuv_table);
 
88
}
 
89
#endif /* CONFIG_HARDCODED_TABLES */
 
90
 
 
91
#endif /* AVCODEC_MOTIONPIXELS_TABLEGEN_H */