1 /*
2 * H.263 internal header
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 #ifndef AVCODEC_H263_H
21 #define AVCODEC_H263_H
22
23 #include <stdint.h>
29
30 #define FF_ASPECT_EXTENDED 15
31 #define INT_BIT (CHAR_BIT * sizeof(int))
32
33 // The defines below define the number of bits that are read at once for
34 // reading vlc values. Changing these may improve speed and data cache needs
35 // be aware though that decreasing them may need the number of stages that is
36 // passed to get_vlc* to be increased.
37 #define H263_MV_VLC_BITS 9
38 #define INTRA_MCBPC_VLC_BITS 6
39 #define INTER_MCBPC_VLC_BITS 7
40 #define CBPY_VLC_BITS 6
41 #define TEX_VLC_BITS 9
42
43 #define H263_GOB_HEIGHT(h) ((h) <= 400 ? 1 : (h) <= 800 ? 2 : 4)
44
49
51
52
57 void *
data,
int *got_frame,
62 int motion_x, int motion_y);
66 int *px, int *py);
79
80
81 /**
82 * Print picture info if FF_DEBUG_PICT_INFO is set.
83 */
85
88 int16_t
block[6][64]);
89
93
94
96 int bit_size,
code, sign;
97
99 return 1; /* ff_mvtab[0][1] */
100 } else {
101 bit_size = f_code - 1;
102 /* modulo encoding */
105 val = (
val ^ sign) - sign;
/* val = FFABS(val) */
108
110 }
111 }
112
118 }else{
121 }
122 }
123
125 int16_t
block[6][64],
126 int motion_x, int motion_y){
128
130 int best_cbpy_score= INT_MAX;
131 int best_cbpc_score= INT_MAX;
132 int cbpc = (-1), cbpy= (-1);
135
138 if(
i&1) score +=
s->coded_score[5];
139 if(
i&2) score +=
s->coded_score[4];
140
141 if(score < best_cbpc_score){
142 best_cbpc_score= score;
144 }
145 }
146
149 if(
i&1) score +=
s->coded_score[3];
150 if(
i&2) score +=
s->coded_score[2];
151 if(
i&4) score +=
s->coded_score[1];
152 if(
i&8) score +=
s->coded_score[0];
153
154 if(score < best_cbpy_score){
155 best_cbpy_score= score;
157 }
158 }
159 cbp= cbpc + 4*cbpy;
160 if ((motion_x | motion_y |
s->dquant) == 0 &&
s->mv_type==
MV_TYPE_16X16){
161 if(best_cbpy_score + best_cbpc_score + 2*lambda >= 0)
162 cbp= 0;
163 }
164
165 for (
i = 0;
i < 6;
i++) {
166 if (
s->block_last_index[
i] >= 0 && ((cbp >> (5 -
i))&1)==0 ){
167 s->block_last_index[
i]= -1;
168 s->bdsp.clear_block(
s->block[
i]);
169 }
170 }
171 }else{
172 cbp= 0;
173 for (
i = 0;
i < 6;
i++) {
174 if (
s->block_last_index[
i] >= 0)
176 }
177 }
178 return cbp;
179 }
180
181 #endif /* AVCODEC_H263_H */