annotate roqvideo.h @ 11104:bb877c9cb102 libavcodec

Detect spatial direct MBs partitioned smaller than 16x16 that can be partitioned as 16x16 (except ones changing interlacing relative to the colocated MB). 20 cycles slower during MV generation 175 cycles faster during MC
author michael
date Mon, 08 Feb 2010 16:23:05 +0000
parents aa459306ee59
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
1 /*
5189
ab669ac706dc right copyrights
benoit
parents: 5184
diff changeset
2 * Copyright (C) 2003 Mike Melanson
ab669ac706dc right copyrights
benoit
parents: 5184
diff changeset
3 * Copyright (C) 2003 Dr. Tim Ferguson
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
4 *
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
5 * This file is part of FFmpeg.
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
6 *
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
11 *
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
15 * Lesser General Public License for more details.
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
16 *
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
20 */
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
21
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6763
diff changeset
22 #ifndef AVCODEC_ROQVIDEO_H
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6763
diff changeset
23 #define AVCODEC_ROQVIDEO_H
5163
9ecbfc0c82bf add multiple inclusion guards to headers
mru
parents: 5104
diff changeset
24
9154
aa459306ee59 Use FLG pseudo-random number generator in RoQ and ELBG
vitor
parents: 8643
diff changeset
25 #include "libavutil/lfg.h"
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
26 #include "avcodec.h"
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
27 #include "dsputil.h"
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
28
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
29 typedef struct {
5190
c356e14774cb indentation
benoit
parents: 5189
diff changeset
30 unsigned char y[4];
c356e14774cb indentation
benoit
parents: 5189
diff changeset
31 unsigned char u, v;
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
32 } roq_cell;
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
33
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
34 typedef struct {
5190
c356e14774cb indentation
benoit
parents: 5189
diff changeset
35 int idx[4];
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
36 } roq_qcell;
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
37
5184
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
38 typedef struct {
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
39 int d[2];
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
40 } motion_vect;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
41
8643
1fa3e8a72ca5 Do not allocate RoqTempData on the stack
vitor
parents: 7760
diff changeset
42 struct RoqTempData;
1fa3e8a72ca5 Do not allocate RoqTempData on the stack
vitor
parents: 7760
diff changeset
43
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
44 typedef struct RoqContext {
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
45
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
46 AVCodecContext *avctx;
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
47 DSPContext dsp;
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
48 AVFrame frames[2];
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
49 AVFrame *last_frame;
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
50 AVFrame *current_frame;
5184
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
51 int first_frame;
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
52
5104
b8e8aa53f613 Rename cb field
benoit
parents: 5088
diff changeset
53 roq_cell cb2x2[256];
b8e8aa53f613 Rename cb field
benoit
parents: 5088
diff changeset
54 roq_qcell cb4x4[256];
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
55
6314
de5d97b6c25b Add some const where appropriate
reimar
parents: 5830
diff changeset
56 const unsigned char *buf;
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
57 int size;
5184
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
58 int width, height;
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
59
5184
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
60 /* Encoder only data */
9154
aa459306ee59 Use FLG pseudo-random number generator in RoQ and ELBG
vitor
parents: 8643
diff changeset
61 AVLFG randctx;
5184
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
62 uint64_t lambda;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
63
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
64 motion_vect *this_motion4;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
65 motion_vect *last_motion4;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
66
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
67 motion_vect *this_motion8;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
68 motion_vect *last_motion8;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
69
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
70 unsigned int framesSinceKeyframe;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
71
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
72 AVFrame *frame_to_enc;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
73 uint8_t *out_buf;
8643
1fa3e8a72ca5 Do not allocate RoqTempData on the stack
vitor
parents: 7760
diff changeset
74 struct RoqTempData *tmpData;
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
75 } RoqContext;
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
76
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
77 #define RoQ_INFO 0x1001
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
78 #define RoQ_QUAD_CODEBOOK 0x1002
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
79 #define RoQ_QUAD_VQ 0x1011
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
80 #define RoQ_SOUND_MONO 0x1020
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
81 #define RoQ_SOUND_STEREO 0x1021
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
82
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
83 #define RoQ_ID_MOT 0x00
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
84 #define RoQ_ID_FCC 0x01
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
85 #define RoQ_ID_SLD 0x02
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
86 #define RoQ_ID_CCC 0x03
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
87
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
88 void ff_apply_vector_2x2(RoqContext *ri, int x, int y, roq_cell *cell);
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
89 void ff_apply_vector_4x4(RoqContext *ri, int x, int y, roq_cell *cell);
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
90
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
91 void ff_apply_motion_4x4(RoqContext *ri, int x, int y, int deltax, int deltay);
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
92
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
93 void ff_apply_motion_8x8(RoqContext *ri, int x, int y, int deltax, int deltay);
5163
9ecbfc0c82bf add multiple inclusion guards to headers
mru
parents: 5104
diff changeset
94
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6763
diff changeset
95 #endif /* AVCODEC_ROQVIDEO_H */