~ubuntu-branches/ubuntu/utopic/libav/utopic-proposed

« back to all changes in this revision

Viewing changes to libavcodec/blockdsp.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler, Reinhard Tartler, Rico Tzschichholz
  • Date: 2014-08-30 11:02:45 UTC
  • mfrom: (1.3.47 sid)
  • Revision ID: package-import@ubuntu.com-20140830110245-io3dg7q85wfr7125
Tags: 6:11~beta1-2
[ Reinhard Tartler ]
* Make libavcodec-dev depend on libavresample-dev

[ Rico Tzschichholz ]
* Some fixes and leftovers from soname bumps

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of Libav.
 
3
 *
 
4
 * Libav is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU Lesser General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2.1 of the License, or (at your option) any later version.
 
8
 *
 
9
 * Libav is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * Lesser General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Lesser General Public
 
15
 * License along with Libav; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
17
 */
 
18
 
 
19
#include <stdint.h>
 
20
#include <string.h>
 
21
 
 
22
#include "config.h"
 
23
#include "libavutil/attributes.h"
 
24
#include "avcodec.h"
 
25
#include "blockdsp.h"
 
26
#include "version.h"
 
27
 
 
28
static void clear_block_8_c(int16_t *block)
 
29
{
 
30
    memset(block, 0, sizeof(int16_t) * 64);
 
31
}
 
32
 
 
33
static void clear_blocks_8_c(int16_t *blocks)
 
34
{
 
35
    memset(blocks, 0, sizeof(int16_t) * 6 * 64);
 
36
}
 
37
 
 
38
static void fill_block16_c(uint8_t *block, uint8_t value, int line_size, int h)
 
39
{
 
40
    int i;
 
41
 
 
42
    for (i = 0; i < h; i++) {
 
43
        memset(block, value, 16);
 
44
        block += line_size;
 
45
    }
 
46
}
 
47
 
 
48
static void fill_block8_c(uint8_t *block, uint8_t value, int line_size, int h)
 
49
{
 
50
    int i;
 
51
 
 
52
    for (i = 0; i < h; i++) {
 
53
        memset(block, value, 8);
 
54
        block += line_size;
 
55
    }
 
56
}
 
57
 
 
58
av_cold void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx)
 
59
{
 
60
    const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
 
61
 
 
62
    c->clear_block  = clear_block_8_c;
 
63
    c->clear_blocks = clear_blocks_8_c;
 
64
 
 
65
    c->fill_block_tab[0] = fill_block16_c;
 
66
    c->fill_block_tab[1] = fill_block8_c;
 
67
 
 
68
    if (ARCH_ARM)
 
69
        ff_blockdsp_init_arm(c, high_bit_depth);
 
70
    if (ARCH_PPC)
 
71
        ff_blockdsp_init_ppc(c, high_bit_depth);
 
72
    if (ARCH_X86)
 
73
#if FF_API_XVMC
 
74
        ff_blockdsp_init_x86(c, high_bit_depth, avctx);
 
75
#else
 
76
        ff_blockdsp_init_x86(c, high_bit_depth);
 
77
#endif /* FF_API_XVMC */
 
78
}