annotate roqvideo.h @ 5694:7c2ce28a0314 libavcodec

Simplify H.264 decode_cabac_mb_cbp_luma(), giving a ~0.5% speedup. patch by Andreas ªÓman, andreas olebyn nu Date: Thu, 20 Sep 2007 12:59:19 +0200 Subject: [FFmpeg-devel] [PATCH] simplify h264's decode_cabac_mb_cbp_luma()
author diego
date Fri, 21 Sep 2007 00:26:31 +0000
parents fa85149193e2
children 1d83e9c34641
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
5163
9ecbfc0c82bf add multiple inclusion guards to headers
mru
parents: 5104
diff changeset
22 #ifndef AVCODEC_ROQVIDEO_H
9ecbfc0c82bf add multiple inclusion guards to headers
mru
parents: 5104
diff changeset
23 #define AVCODEC_ROQVIDEO_H
9ecbfc0c82bf add multiple inclusion guards to headers
mru
parents: 5104
diff changeset
24
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
25 #include "avcodec.h"
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
26 #include "dsputil.h"
5184
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
27 #include "random.h"
5080
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
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
42 typedef struct RoqContext {
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
43
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
44 AVCodecContext *avctx;
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
45 DSPContext dsp;
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
46 AVFrame frames[2];
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
47 AVFrame *last_frame;
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
48 AVFrame *current_frame;
5184
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
49 int first_frame;
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
50
5104
b8e8aa53f613 Rename cb field
benoit
parents: 5088
diff changeset
51 roq_cell cb2x2[256];
b8e8aa53f613 Rename cb field
benoit
parents: 5088
diff changeset
52 roq_qcell cb4x4[256];
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
53
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
54 unsigned char *buf;
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
55 int size;
5184
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
56 int width, height;
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
57
5184
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
58 /* Encoder only data */
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
59 AVRandomState randctx;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
60 uint64_t lambda;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
61
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
62 motion_vect *this_motion4;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
63 motion_vect *last_motion4;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
64
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
65 motion_vect *this_motion8;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
66 motion_vect *last_motion8;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
67
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
68 unsigned int framesSinceKeyframe;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
69
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
70 AVFrame *frame_to_enc;
f3873cd7f473 RoQ video encoder
benoit
parents: 5169
diff changeset
71 uint8_t *out_buf;
5080
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
72 } RoqContext;
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
73
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
74 #define RoQ_INFO 0x1001
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
75 #define RoQ_QUAD_CODEBOOK 0x1002
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
76 #define RoQ_QUAD_VQ 0x1011
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
77 #define RoQ_SOUND_MONO 0x1020
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
78 #define RoQ_SOUND_STEREO 0x1021
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
79
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
80 #define RoQ_ID_MOT 0x00
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
81 #define RoQ_ID_FCC 0x01
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
82 #define RoQ_ID_SLD 0x02
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
83 #define RoQ_ID_CCC 0x03
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
84
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
85 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
86 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
87
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
88 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
89
e72265f4e518 Split RoQ decoder to accommodate future encoder patch
benoit
parents:
diff changeset
90 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
91
5169
3fd46e281bd8 add a comment to indicate which #endif belong to which #define
gpoirier
parents: 5163
diff changeset
92 #endif // AVCODEC_ROQVIDEO_H