annotate libmpeg2/stats.c @ 626:550ea1eba1a1

-nodshow/-dshow added, -afm is working again
author arpi_esp
date Tue, 24 Apr 2001 22:51:05 +0000
parents 846535ace7a2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 * stats.c
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
3 * Copyright (C) 1999-2001 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 * mpeg2dec is free software; you can redistribute it and/or modify
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 * (at your option) any later version.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 * mpeg2dec is distributed in the hope that it will be useful,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 * GNU General Public License for more details.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 #include "config.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 #include <inttypes.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 #include "mpeg2_internal.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 static int debug_level = -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
32 /* Determine is debug output is required. */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
33 /* We could potentially have multiple levels of debug info */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 static int debug_is_on (void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 char * env_var;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 if (debug_level < 0) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 env_var = getenv ("MPEG2_DEBUG");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 if (env_var)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 debug_level = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 debug_level = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 return debug_level;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 static void stats_picture (uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 static char * picture_coding_type_str [8] = {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 "Invalid picture type",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 "I-type",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 "P-type",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 "B-type",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 "D (very bad)",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 "Invalid","Invalid","Invalid"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 int picture_coding_type;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 int temporal_reference;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 int vbv_delay;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 temporal_reference = (buffer[0] << 2) | (buffer[1] >> 6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 picture_coding_type = (buffer [1] >> 3) & 7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 vbv_delay = ((buffer[1] << 13) | (buffer[2] << 5) |
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 (buffer[3] >> 3)) & 0xffff;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 fprintf (stderr, " (picture) %s temporal_reference %d, vbv_delay %d\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 picture_coding_type_str [picture_coding_type],
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 temporal_reference, vbv_delay);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 static void stats_user_data (uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 fprintf (stderr, " (user_data)\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 static void stats_sequence (uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 static char * aspect_ratio_information_str[8] = {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 "Invalid Aspect Ratio",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 "1:1",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 "4:3",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 "16:9",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 "2.21:1",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 "Invalid Aspect Ratio",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 "Invalid Aspect Ratio",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 "Invalid Aspect Ratio"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 static char * frame_rate_str[16] = {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 "Invalid frame_rate_code",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 "23.976", "24", "25" , "29.97",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 "30" , "50", "59.94", "60" ,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 "Invalid frame_rate_code", "Invalid frame_rate_code",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 "Invalid frame_rate_code", "Invalid frame_rate_code",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 "Invalid frame_rate_code", "Invalid frame_rate_code",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 "Invalid frame_rate_code"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 int horizontal_size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 int vertical_size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 int aspect_ratio_information;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 int frame_rate_code;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106 int bit_rate_value;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 int vbv_buffer_size_value;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 int constrained_parameters_flag;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 int load_intra_quantizer_matrix;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 int load_non_intra_quantizer_matrix;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 vertical_size = (buffer[0] << 16) | (buffer[1] << 8) | buffer[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 horizontal_size = vertical_size >> 12;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 vertical_size &= 0xfff;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 aspect_ratio_information = buffer[3] >> 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 frame_rate_code = buffer[3] & 15;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 bit_rate_value = (buffer[4] << 10) | (buffer[5] << 2) | (buffer[6] >> 6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 vbv_buffer_size_value = ((buffer[6] << 5) | (buffer[7] >> 3)) & 0x3ff;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 constrained_parameters_flag = buffer[7] & 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 load_intra_quantizer_matrix = buffer[7] & 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 if (load_intra_quantizer_matrix)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 buffer += 64;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 load_non_intra_quantizer_matrix = buffer[7] & 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125 fprintf (stderr, " (seq) %dx%d %s, %s fps, %5.0f kbps, VBV %d kB%s%s%s\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126 horizontal_size, vertical_size,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 aspect_ratio_information_str [aspect_ratio_information],
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128 frame_rate_str [frame_rate_code],
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129 bit_rate_value * 400.0 / 1000.0,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130 2 * vbv_buffer_size_value,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 constrained_parameters_flag ? " , CP":"",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 load_intra_quantizer_matrix ? " , Custom Intra Matrix":"",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133 load_non_intra_quantizer_matrix ? " , Custom Non-Intra Matrix":"");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136 static void stats_sequence_error (uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138 fprintf (stderr, " (sequence_error)\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 static void stats_sequence_end (uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 fprintf (stderr, " (sequence_end)\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 static void stats_group (uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148 fprintf (stderr, " (group)%s%s\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 (buffer[4] & 0x40) ? " closed_gop" : "",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150 (buffer[4] & 0x20) ? " broken_link" : "");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 static void stats_slice (uint8_t code, uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 {
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
155 /* fprintf (stderr, " (slice %d)\n", code); */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158 static void stats_sequence_extension (uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 static char * chroma_format_str[4] = {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 "Invalid Chroma Format",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162 "4:2:0 Chroma",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163 "4:2:2 Chroma",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164 "4:4:4 Chroma"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 int progressive_sequence;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 int chroma_format;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170 progressive_sequence = (buffer[1] >> 3) & 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171 chroma_format = (buffer[1] >> 1) & 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 fprintf (stderr, " (seq_ext) progressive_sequence %d, %s\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174 progressive_sequence, chroma_format_str [chroma_format]);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 static void stats_sequence_display_extension (uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179 fprintf (stderr, " (sequence_display_extension)\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 static void stats_quant_matrix_extension (uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 fprintf (stderr, " (quant_matrix_extension)\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 static void stats_copyright_extension (uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 fprintf (stderr, " (copyright_extension)\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 static void stats_sequence_scalable_extension (uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 fprintf (stderr, " (sequence_scalable_extension)\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 static void stats_picture_display_extension (uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 fprintf (stderr, " (picture_display_extension)\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203 static void stats_picture_coding_extension (uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 static char * picture_structure_str[4] = {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 "Invalid Picture Structure",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 "Top field",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 "Bottom field",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 "Frame Picture"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 int f_code[2][2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 int intra_dc_precision;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 int picture_structure;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 int top_field_first;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 int frame_pred_frame_dct;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217 int concealment_motion_vectors;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 int q_scale_type;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 int intra_vlc_format;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 int alternate_scan;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 int repeat_first_field;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 int progressive_frame;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224 f_code[0][0] = buffer[0] & 15;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 f_code[0][1] = buffer[1] >> 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226 f_code[1][0] = buffer[1] & 15;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227 f_code[1][1] = buffer[2] >> 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228 intra_dc_precision = (buffer[2] >> 2) & 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 picture_structure = buffer[2] & 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230 top_field_first = buffer[3] >> 7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231 frame_pred_frame_dct = (buffer[3] >> 6) & 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232 concealment_motion_vectors = (buffer[3] >> 5) & 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233 q_scale_type = (buffer[3] >> 4) & 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 intra_vlc_format = (buffer[3] >> 3) & 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235 alternate_scan = (buffer[3] >> 2) & 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 repeat_first_field = (buffer[3] >> 1) & 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 progressive_frame = buffer[4] >> 7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239 fprintf (stderr,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 " (pic_ext) %s\n", picture_structure_str [picture_structure]);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 fprintf (stderr,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242 " (pic_ext) forward horizontal f_code % d, forward vertical f_code % d\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243 f_code[0][0], f_code[0][1]);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244 fprintf (stderr,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245 " (pic_ext) backward horizontal f_code % d, backward vertical f_code % d\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246 f_code[1][0], f_code[1][1]);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
247 fprintf (stderr,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
248 " (pic_ext) intra_dc_precision %d, top_field_first %d, frame_pred_frame_dct %d\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
249 intra_dc_precision, top_field_first, frame_pred_frame_dct);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
250 fprintf (stderr,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
251 " (pic_ext) concealment_motion_vectors %d, q_scale_type %d, intra_vlc_format %d\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252 concealment_motion_vectors, q_scale_type, intra_vlc_format);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253 fprintf (stderr,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
254 " (pic_ext) alternate_scan %d, repeat_first_field %d, progressive_frame %d\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255 alternate_scan, repeat_first_field, progressive_frame);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
257
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
258 void stats_header (uint8_t code, uint8_t * buffer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260 if (! (debug_is_on ()))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263 switch (code) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264 case 0x00:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
265 stats_picture (buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267 case 0xb2:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268 stats_user_data (buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
270 case 0xb3:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
271 stats_sequence (buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
272 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
273 case 0xb4:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
274 stats_sequence_error (buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
275 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
276 case 0xb5:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
277 switch (buffer[0] >> 4) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
278 case 1:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
279 stats_sequence_extension (buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
280 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
281 case 2:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
282 stats_sequence_display_extension (buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
283 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
284 case 3:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
285 stats_quant_matrix_extension (buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
287 case 4:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
288 stats_copyright_extension (buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
289 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290 case 5:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
291 stats_sequence_scalable_extension (buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
292 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
293 case 7:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
294 stats_picture_display_extension (buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
295 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
296 case 8:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
297 stats_picture_coding_extension (buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
298 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
299 default:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300 fprintf (stderr, " (unknown extension %#x)\n", buffer[0] >> 4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
301 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
303 case 0xb7:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
304 stats_sequence_end (buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
305 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
306 case 0xb8:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
307 stats_group (buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
308 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
309 default:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310 if (code < 0xb0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
311 stats_slice (code, buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
312 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
313 fprintf (stderr, " (unknown start code %#02x)\n", code);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
314 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
315 }