annotate intelh263dec.c @ 10930:b4e6b2d301ad libavcodec

Cosmetic, get rid of &x[0]
author michael
date Mon, 18 Jan 2010 23:55:19 +0000
parents d0657e337f91
children 8a4984c5cacc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10791
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
1 /*
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
2 * H.263i decoder
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
3 *
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
4 * This file is part of FFmpeg.
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
5 *
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
10 *
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
14 * Lesser General Public License for more details.
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
15 *
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
19 */
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
20
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
21 #include "mpegvideo.h"
10828
d0657e337f91 Split H263 encoder and decoder from common code.
michael
parents: 10812
diff changeset
22 #include "h263.h"
10791
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
23
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
24 /* don't understand why they choose a different header ! */
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
25 int ff_intel_h263_decode_picture_header(MpegEncContext *s)
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
26 {
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
27 int format;
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
28
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
29 /* picture header */
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
30 if (get_bits_long(&s->gb, 22) != 0x20) {
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
31 av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
32 return -1;
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
33 }
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
34 s->picture_number = get_bits(&s->gb, 8); /* picture timestamp */
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
35
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
36 if (get_bits1(&s->gb) != 1) {
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
37 av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n");
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
38 return -1; /* marker */
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
39 }
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
40 if (get_bits1(&s->gb) != 0) {
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
41 av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n");
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
42 return -1; /* h263 id */
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
43 }
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
44 skip_bits1(&s->gb); /* split screen off */
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
45 skip_bits1(&s->gb); /* camera off */
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
46 skip_bits1(&s->gb); /* freeze picture release off */
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
47
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
48 format = get_bits(&s->gb, 3);
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
49 if (format != 7) {
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
50 av_log(s->avctx, AV_LOG_ERROR, "Intel H263 free format not supported\n");
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
51 return -1;
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
52 }
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
53 s->h263_plus = 0;
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
54
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
55 s->pict_type = FF_I_TYPE + get_bits1(&s->gb);
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
56
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
57 s->unrestricted_mv = get_bits1(&s->gb);
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
58 s->h263_long_vectors = s->unrestricted_mv;
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
59
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
60 if (get_bits1(&s->gb) != 0) {
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
61 av_log(s->avctx, AV_LOG_ERROR, "SAC not supported\n");
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
62 return -1; /* SAC: off */
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
63 }
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
64 s->obmc= get_bits1(&s->gb);
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
65 s->pb_frame = get_bits1(&s->gb);
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
66
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
67 if(format == 7){
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
68 format = get_bits(&s->gb, 3);
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
69 if(format == 0 || format == 7){
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
70 av_log(s->avctx, AV_LOG_ERROR, "Wrong Intel H263 format\n");
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
71 return -1;
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
72 }
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
73 if(get_bits(&s->gb, 2))
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
74 av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
75 s->loop_filter = get_bits1(&s->gb);
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
76 if(get_bits1(&s->gb))
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
77 av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
78 if(get_bits1(&s->gb))
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
79 s->pb_frame = 2;
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
80 if(get_bits(&s->gb, 5))
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
81 av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
82 if(get_bits(&s->gb, 5) != 1)
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
83 av_log(s->avctx, AV_LOG_ERROR, "Invalid marker\n");
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
84 }
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
85 if(format == 6){
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
86 int ar = get_bits(&s->gb, 4);
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
87 skip_bits(&s->gb, 9); // display width
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
88 skip_bits1(&s->gb);
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
89 skip_bits(&s->gb, 9); // display height
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
90 if(ar == 15){
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
91 skip_bits(&s->gb, 8); // aspect ratio - width
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
92 skip_bits(&s->gb, 8); // aspect ratio - height
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
93 }
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
94 }
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
95
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
96 s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
97 skip_bits1(&s->gb); /* Continuous Presence Multipoint mode: off */
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
98
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
99 if(s->pb_frame){
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
100 skip_bits(&s->gb, 3); //temporal reference for B-frame
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
101 skip_bits(&s->gb, 2); //dbquant
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
102 }
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
103
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
104 /* PEI */
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
105 while (get_bits1(&s->gb) != 0) {
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
106 skip_bits(&s->gb, 8);
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
107 }
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
108 s->f_code = 1;
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
109
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
110 s->y_dc_scale_table=
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
111 s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
112
10812
238c62c8728e Fix indention.
michael
parents: 10793
diff changeset
113 ff_h263_show_pict_info(s);
10791
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
114
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
115 return 0;
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
116 }
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
117
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
118 AVCodec h263i_decoder = {
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
119 "h263i",
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
120 CODEC_TYPE_VIDEO,
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
121 CODEC_ID_H263I,
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
122 sizeof(MpegEncContext),
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
123 ff_h263_decode_init,
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
124 NULL,
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
125 ff_h263_decode_end,
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
126 ff_h263_decode_frame,
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
127 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
128 .long_name = NULL_IF_CONFIG_SMALL("Intel H.263"),
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
129 .pix_fmts= ff_pixfmt_list_420,
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
130 };
48adb5a1b47b Split out intel H263 decoder.
michael
parents:
diff changeset
131