Revision bd38efff

View differences:

libavcodec/Makefile
85 85
OBJS-$(CONFIG_H263_ENCODER)            += mpegvideo_enc.o motion_est.o ratecontrol.o h263.o
86 86
OBJS-$(CONFIG_H263P_ENCODER)           += mpegvideo_enc.o motion_est.o ratecontrol.o h263.o
87 87
OBJS-$(CONFIG_H264_DECODER)            += h264.o h264idct.o cabac.o golomb.o
88
OBJS-$(CONFIG_H264_ENCODER)            += h264enc.o h264dsp.o
88
OBJS-$(CONFIG_H264_ENCODER)            += h264enc.o h264dspenc.o
89 89
OBJS-$(CONFIG_HUFFYUV_DECODER)         += huffyuv.o
90 90
OBJS-$(CONFIG_HUFFYUV_ENCODER)         += huffyuv.o
91 91
OBJS-$(CONFIG_IDCIN_DECODER)           += idcinvideo.o
libavcodec/h264dsp.c
1
/*
2
 * H.264/MPEG-4 Part 10 (Base profile) encoder.
3
 *
4
 * DSP functions
5
 *
6
 * Copyright (c) 2006 Expertisecentrum Digitale Media, UHasselt
7
 *
8
 * FFmpeg 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
 * FFmpeg 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 FFmpeg; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
 */
22

  
23
/**
24
 * @file h264dsp.c
25
 * H.264 encoder related DSP utils
26
 *
27
 */
28

  
29
#include "dsputil.h"
30

  
31
extern const uint8_t ff_div6[52];
32
extern const uint8_t ff_rem6[52];
33

  
34
#define  H264_DCT_PART1(X) \
35
         a = block[0][X]+block[3][X]; \
36
         c = block[0][X]-block[3][X]; \
37
         b = block[1][X]+block[2][X]; \
38
         d = block[1][X]-block[2][X]; \
39
         pieces[0][X] = a+b; \
40
         pieces[2][X] = a-b; \
41
         pieces[1][X] = (c<<1)+d; \
42
         pieces[3][X] = c-(d<<1);
43

  
44
#define  H264_DCT_PART2(X) \
45
         a = pieces[X][0]+pieces[X][3]; \
46
         c = pieces[X][0]-pieces[X][3]; \
47
         b = pieces[X][1]+pieces[X][2]; \
48
         d = pieces[X][1]-pieces[X][2]; \
49
         block[0][X] = a+b; \
50
         block[2][X] = a-b; \
51
         block[1][X] = (c<<1)+d; \
52
         block[3][X] = c-(d<<1);
53

  
54
/**
55
 * Transform the provided matrix using the H.264 modified DCT.
56
 * @note
57
 * we'll always work with transposed input blocks, to avoid having to make a
58
 * distinction between C and mmx implementations.
59
 *
60
 * @param block transposed input block
61
 */
62
static void h264_dct_c(DCTELEM block[4][4])
63
{
64
    DCTELEM pieces[4][4];
65
    DCTELEM a, b, c, d;
66

  
67
    H264_DCT_PART1(0);
68
    H264_DCT_PART1(1);
69
    H264_DCT_PART1(2);
70
    H264_DCT_PART1(3);
71
    H264_DCT_PART2(0);
72
    H264_DCT_PART2(1);
73
    H264_DCT_PART2(2);
74
    H264_DCT_PART2(3);
75
}
76

  
77
void ff_h264dsp_init(DSPContext* c, AVCodecContext *avctx)
78
{
79
    c->h264_dct = h264_dct_c;
80
}
81

  
libavcodec/h264dspenc.c
1
/*
2
 * H.264/MPEG-4 Part 10 (Base profile) encoder.
3
 *
4
 * DSP functions
5
 *
6
 * Copyright (c) 2006 Expertisecentrum Digitale Media, UHasselt
7
 *
8
 * FFmpeg 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
 * FFmpeg 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 FFmpeg; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
 */
22

  
23
/**
24
 * @file h264dsp.c
25
 * H.264 encoder related DSP utils
26
 *
27
 */
28

  
29
#include "dsputil.h"
30

  
31
extern const uint8_t ff_div6[52];
32
extern const uint8_t ff_rem6[52];
33

  
34
#define  H264_DCT_PART1(X) \
35
         a = block[0][X]+block[3][X]; \
36
         c = block[0][X]-block[3][X]; \
37
         b = block[1][X]+block[2][X]; \
38
         d = block[1][X]-block[2][X]; \
39
         pieces[0][X] = a+b; \
40
         pieces[2][X] = a-b; \
41
         pieces[1][X] = (c<<1)+d; \
42
         pieces[3][X] = c-(d<<1);
43

  
44
#define  H264_DCT_PART2(X) \
45
         a = pieces[X][0]+pieces[X][3]; \
46
         c = pieces[X][0]-pieces[X][3]; \
47
         b = pieces[X][1]+pieces[X][2]; \
48
         d = pieces[X][1]-pieces[X][2]; \
49
         block[0][X] = a+b; \
50
         block[2][X] = a-b; \
51
         block[1][X] = (c<<1)+d; \
52
         block[3][X] = c-(d<<1);
53

  
54
/**
55
 * Transform the provided matrix using the H.264 modified DCT.
56
 * @note
57
 * we'll always work with transposed input blocks, to avoid having to make a
58
 * distinction between C and mmx implementations.
59
 *
60
 * @param block transposed input block
61
 */
62
static void h264_dct_c(DCTELEM block[4][4])
63
{
64
    DCTELEM pieces[4][4];
65
    DCTELEM a, b, c, d;
66

  
67
    H264_DCT_PART1(0);
68
    H264_DCT_PART1(1);
69
    H264_DCT_PART1(2);
70
    H264_DCT_PART1(3);
71
    H264_DCT_PART2(0);
72
    H264_DCT_PART2(1);
73
    H264_DCT_PART2(2);
74
    H264_DCT_PART2(3);
75
}
76

  
77
void ff_h264dsp_init(DSPContext* c, AVCodecContext *avctx)
78
{
79
    c->h264_dct = h264_dct_c;
80
}
81

  

Also available in: Unified diff