Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
df96f22d
Commit
df96f22d
authored
Jun 02, 2011
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace custom debug output functions by av_dlog().
parent
752207e3
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
161 additions
and
181 deletions
+161
-181
interplayvideo.c
libavcodec/interplayvideo.c
+8
-16
vorbisdec.c
libavcodec/vorbisdec.c
+101
-93
vqavideo.c
libavcodec/vqavideo.c
+6
-14
ipmovie.c
libavformat/ipmovie.c
+46
-58
No files found.
libavcodec/interplayvideo.c
View file @
df96f22d
...
...
@@ -46,14 +46,6 @@
#define PALETTE_COUNT 256
/* debugging support */
#define DEBUG_INTERPLAY 0
#if DEBUG_INTERPLAY
#define debug_interplay(x,...) av_log(NULL, AV_LOG_DEBUG, x, __VA_ARGS__)
#else
static
inline
void
debug_interplay
(
const
char
*
format
,
...)
{
}
#endif
typedef
struct
IpvideoContext
{
AVCodecContext
*
avctx
;
...
...
@@ -141,7 +133,7 @@ static int ipvideo_decode_block_opcode_0x2(IpvideoContext *s)
y
=
8
+
((
B
-
56
)
/
29
);
}
debug_interplay
(
" motion byte = %d, (x, y) = (%d, %d)
\n
"
,
B
,
x
,
y
);
av_dlog
(
NULL
,
" motion byte = %d, (x, y) = (%d, %d)
\n
"
,
B
,
x
,
y
);
return
copy_from
(
s
,
&
s
->
second_last_frame
,
x
,
y
);
}
...
...
@@ -169,7 +161,7 @@ static int ipvideo_decode_block_opcode_0x3(IpvideoContext *s)
y
=
-
(
8
+
((
B
-
56
)
/
29
));
}
debug_interplay
(
" motion byte = %d, (x, y) = (%d, %d)
\n
"
,
B
,
x
,
y
);
av_dlog
(
NULL
,
" motion byte = %d, (x, y) = (%d, %d)
\n
"
,
B
,
x
,
y
);
return
copy_from
(
s
,
&
s
->
current_frame
,
x
,
y
);
}
...
...
@@ -192,7 +184,7 @@ static int ipvideo_decode_block_opcode_0x4(IpvideoContext *s)
x
=
-
8
+
BL
;
y
=
-
8
+
BH
;
debug_interplay
(
" motion byte = %d, (x, y) = (%d, %d)
\n
"
,
B
,
x
,
y
);
av_dlog
(
NULL
,
" motion byte = %d, (x, y) = (%d, %d)
\n
"
,
B
,
x
,
y
);
return
copy_from
(
s
,
&
s
->
last_frame
,
x
,
y
);
}
...
...
@@ -207,7 +199,7 @@ static int ipvideo_decode_block_opcode_0x5(IpvideoContext *s)
x
=
*
s
->
stream_ptr
++
;
y
=
*
s
->
stream_ptr
++
;
debug_interplay
(
" motion bytes = %d, %d
\n
"
,
x
,
y
);
av_dlog
(
NULL
,
" motion bytes = %d, %d
\n
"
,
x
,
y
);
return
copy_from
(
s
,
&
s
->
last_frame
,
x
,
y
);
}
...
...
@@ -588,7 +580,7 @@ static int ipvideo_decode_block_opcode_0x6_16(IpvideoContext *s)
x
=
*
s
->
stream_ptr
++
;
y
=
*
s
->
stream_ptr
++
;
debug_interplay
(
" motion bytes = %d, %d
\n
"
,
x
,
y
);
av_dlog
(
NULL
,
" motion bytes = %d, %d
\n
"
,
x
,
y
);
return
copy_from
(
s
,
&
s
->
second_last_frame
,
x
,
y
);
}
...
...
@@ -965,7 +957,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
static
int
frame
=
0
;
GetBitContext
gb
;
debug_interplay
(
"------------------ frame %d
\n
"
,
frame
);
av_dlog
(
NULL
,
"------------------ frame %d
\n
"
,
frame
);
frame
++
;
if
(
!
s
->
is_16bpp
)
{
...
...
@@ -991,7 +983,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
for
(
x
=
0
;
x
<
s
->
avctx
->
width
;
x
+=
8
)
{
opcode
=
get_bits
(
&
gb
,
4
);
debug_interplay
(
" block @ (%3d, %3d): encoding 0x%X, data ptr @ %p
\n
"
,
av_dlog
(
NULL
,
" block @ (%3d, %3d): encoding 0x%X, data ptr @ %p
\n
"
,
x
,
y
,
opcode
,
s
->
stream_ptr
);
if
(
!
s
->
is_16bpp
)
{
...
...
libavcodec/vorbisdec.c
View file @
df96f22d
...
...
@@ -20,10 +20,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#undef V_DEBUG
//#define V_DEBUG
//#define AV_DEBUG(...) av_log(NULL, AV_LOG_INFO, __VA_ARGS__)
#include <math.h>
#define ALT_BITSTREAM_READER_LE
...
...
@@ -41,10 +37,6 @@
#define V_MAX_VLCS (1 << 16)
#define V_MAX_PARTITIONS (1 << 20)
#ifndef V_DEBUG
#define AV_DEBUG(...)
#endif
#undef NDEBUG
#include <assert.h>
...
...
@@ -245,7 +237,7 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
vc
->
codebook_count
=
get_bits
(
gb
,
8
)
+
1
;
AV_DEBUG
(
" Codebooks: %d
\n
"
,
vc
->
codebook_count
);
av_dlog
(
NULL
,
" Codebooks: %d
\n
"
,
vc
->
codebook_count
);
vc
->
codebooks
=
av_mallocz
(
vc
->
codebook_count
*
sizeof
(
*
vc
->
codebooks
));
tmp_vlc_bits
=
av_mallocz
(
V_MAX_VLCS
*
sizeof
(
*
tmp_vlc_bits
));
...
...
@@ -256,7 +248,7 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
vorbis_codebook
*
codebook_setup
=
&
vc
->
codebooks
[
cb
];
unsigned
ordered
,
t
,
entries
,
used_entries
=
0
;
AV_DEBUG
(
" %u. Codebook
\n
"
,
cb
);
av_dlog
(
NULL
,
" %u. Codebook
\n
"
,
cb
);
if
(
get_bits
(
gb
,
24
)
!=
0x564342
)
{
av_log
(
vc
->
avccontext
,
AV_LOG_ERROR
,
...
...
@@ -281,17 +273,17 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
ordered
=
get_bits1
(
gb
);
AV_DEBUG
(
" codebook_dimensions %d, codebook_entries %u
\n
"
,
av_dlog
(
NULL
,
" codebook_dimensions %d, codebook_entries %u
\n
"
,
codebook_setup
->
dimensions
,
entries
);
if
(
!
ordered
)
{
unsigned
ce
,
flag
;
unsigned
sparse
=
get_bits1
(
gb
);
AV_DEBUG
(
" not ordered
\n
"
);
av_dlog
(
NULL
,
" not ordered
\n
"
);
if
(
sparse
)
{
AV_DEBUG
(
" sparse
\n
"
);
av_dlog
(
NULL
,
" sparse
\n
"
);
used_entries
=
0
;
for
(
ce
=
0
;
ce
<
entries
;
++
ce
)
{
...
...
@@ -303,7 +295,7 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
tmp_vlc_bits
[
ce
]
=
0
;
}
}
else
{
AV_DEBUG
(
" not sparse
\n
"
);
av_dlog
(
NULL
,
" not sparse
\n
"
);
used_entries
=
entries
;
for
(
ce
=
0
;
ce
<
entries
;
++
ce
)
...
...
@@ -313,17 +305,17 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
unsigned
current_entry
=
0
;
unsigned
current_length
=
get_bits
(
gb
,
5
)
+
1
;
AV_DEBUG
(
" ordered, current length: %u
\n
"
,
current_length
);
//FIXME
av_dlog
(
NULL
,
" ordered, current length: %u
\n
"
,
current_length
);
//FIXME
used_entries
=
entries
;
for
(;
current_entry
<
used_entries
&&
current_length
<=
32
;
++
current_length
)
{
unsigned
i
,
number
;
AV_DEBUG
(
" number bits: %u "
,
ilog
(
entries
-
current_entry
));
av_dlog
(
NULL
,
" number bits: %u "
,
ilog
(
entries
-
current_entry
));
number
=
get_bits
(
gb
,
ilog
(
entries
-
current_entry
));
AV_DEBUG
(
" number: %u
\n
"
,
number
);
av_dlog
(
NULL
,
" number: %u
\n
"
,
number
);
for
(
i
=
current_entry
;
i
<
number
+
current_entry
;
++
i
)
if
(
i
<
used_entries
)
...
...
@@ -339,7 +331,8 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
codebook_setup
->
lookup_type
=
get_bits
(
gb
,
4
);
AV_DEBUG
(
" lookup type: %d : %s
\n
"
,
codebook_setup
->
lookup_type
,
codebook_setup
->
lookup_type
?
"vq"
:
"no lookup"
);
av_dlog
(
NULL
,
" lookup type: %d : %s
\n
"
,
codebook_setup
->
lookup_type
,
codebook_setup
->
lookup_type
?
"vq"
:
"no lookup"
);
// If the codebook is used for (inverse) VQ, calculate codevectors.
...
...
@@ -352,14 +345,17 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
unsigned
codebook_value_bits
=
get_bits
(
gb
,
4
)
+
1
;
unsigned
codebook_sequence_p
=
get_bits1
(
gb
);
AV_DEBUG
(
" We expect %d numbers for building the codevectors.
\n
"
,
codebook_lookup_values
);
AV_DEBUG
(
" delta %f minmum %f
\n
"
,
codebook_delta_value
,
codebook_minimum_value
);
av_dlog
(
NULL
,
" We expect %d numbers for building the codevectors.
\n
"
,
codebook_lookup_values
);
av_dlog
(
NULL
,
" delta %f minmum %f
\n
"
,
codebook_delta_value
,
codebook_minimum_value
);
for
(
i
=
0
;
i
<
codebook_lookup_values
;
++
i
)
{
codebook_multiplicands
[
i
]
=
get_bits
(
gb
,
codebook_value_bits
);
AV_DEBUG
(
" multiplicands*delta+minmum : %e
\n
"
,
(
float
)
codebook_multiplicands
[
i
]
*
codebook_delta_value
+
codebook_minimum_value
);
AV_DEBUG
(
" multiplicand %u
\n
"
,
codebook_multiplicands
[
i
]);
av_dlog
(
NULL
,
" multiplicands*delta+minmum : %e
\n
"
,
(
float
)
codebook_multiplicands
[
i
]
*
codebook_delta_value
+
codebook_minimum_value
);
av_dlog
(
NULL
,
" multiplicand %u
\n
"
,
codebook_multiplicands
[
i
]);
}
// Weed out unused vlcs and build codevector vector
...
...
@@ -453,7 +449,7 @@ static int vorbis_parse_setup_hdr_tdtransforms(vorbis_context *vc)
for
(
i
=
0
;
i
<
vorbis_time_count
;
++
i
)
{
unsigned
vorbis_tdtransform
=
get_bits
(
gb
,
16
);
AV_DEBUG
(
" Vorbis time domain transform %u: %u
\n
"
,
av_dlog
(
NULL
,
" Vorbis time domain transform %u: %u
\n
"
,
vorbis_time_count
,
vorbis_tdtransform
);
if
(
vorbis_tdtransform
)
{
...
...
@@ -485,7 +481,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
floor_setup
->
floor_type
=
get_bits
(
gb
,
16
);
AV_DEBUG
(
" %d. floor type %d
\n
"
,
i
,
floor_setup
->
floor_type
);
av_dlog
(
NULL
,
" %d. floor type %d
\n
"
,
i
,
floor_setup
->
floor_type
);
if
(
floor_setup
->
floor_type
==
1
)
{
int
maximum_class
=
-
1
;
...
...
@@ -495,29 +491,33 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
floor_setup
->
data
.
t1
.
partitions
=
get_bits
(
gb
,
5
);
AV_DEBUG
(
" %d.floor: %d partitions
\n
"
,
i
,
floor_setup
->
data
.
t1
.
partitions
);
av_dlog
(
NULL
,
" %d.floor: %d partitions
\n
"
,
i
,
floor_setup
->
data
.
t1
.
partitions
);
for
(
j
=
0
;
j
<
floor_setup
->
data
.
t1
.
partitions
;
++
j
)
{
floor_setup
->
data
.
t1
.
partition_class
[
j
]
=
get_bits
(
gb
,
4
);
if
(
floor_setup
->
data
.
t1
.
partition_class
[
j
]
>
maximum_class
)
maximum_class
=
floor_setup
->
data
.
t1
.
partition_class
[
j
];
AV_DEBUG
(
" %d. floor %d partition class %d
\n
"
,
i
,
j
,
floor_setup
->
data
.
t1
.
partition_class
[
j
]);
av_dlog
(
NULL
,
" %d. floor %d partition class %d
\n
"
,
i
,
j
,
floor_setup
->
data
.
t1
.
partition_class
[
j
]);
}
AV_DEBUG
(
" maximum class %d
\n
"
,
maximum_class
);
av_dlog
(
NULL
,
" maximum class %d
\n
"
,
maximum_class
);
for
(
j
=
0
;
j
<=
maximum_class
;
++
j
)
{
floor_setup
->
data
.
t1
.
class_dimensions
[
j
]
=
get_bits
(
gb
,
3
)
+
1
;
floor_setup
->
data
.
t1
.
class_subclasses
[
j
]
=
get_bits
(
gb
,
2
);
AV_DEBUG
(
" %d floor %d class dim: %d subclasses %d
\n
"
,
i
,
j
,
floor_setup
->
data
.
t1
.
class_dimensions
[
j
],
floor_setup
->
data
.
t1
.
class_subclasses
[
j
]);
av_dlog
(
NULL
,
" %d floor %d class dim: %d subclasses %d
\n
"
,
i
,
j
,
floor_setup
->
data
.
t1
.
class_dimensions
[
j
],
floor_setup
->
data
.
t1
.
class_subclasses
[
j
]);
if
(
floor_setup
->
data
.
t1
.
class_subclasses
[
j
])
{
GET_VALIDATED_INDEX
(
floor_setup
->
data
.
t1
.
class_masterbook
[
j
],
8
,
vc
->
codebook_count
)
AV_DEBUG
(
" masterbook: %d
\n
"
,
floor_setup
->
data
.
t1
.
class_masterbook
[
j
]);
av_dlog
(
NULL
,
" masterbook: %d
\n
"
,
floor_setup
->
data
.
t1
.
class_masterbook
[
j
]);
}
for
(
k
=
0
;
k
<
(
1
<<
floor_setup
->
data
.
t1
.
class_subclasses
[
j
]);
++
k
)
{
...
...
@@ -526,7 +526,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
VALIDATE_INDEX
(
bits
,
vc
->
codebook_count
)
floor_setup
->
data
.
t1
.
subclass_books
[
j
][
k
]
=
bits
;
AV_DEBUG
(
" book %d. : %d
\n
"
,
k
,
floor_setup
->
data
.
t1
.
subclass_books
[
j
][
k
]);
av_dlog
(
NULL
,
" book %d. : %d
\n
"
,
k
,
floor_setup
->
data
.
t1
.
subclass_books
[
j
][
k
]);
}
}
...
...
@@ -555,7 +555,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
for
(
k
=
0
;
k
<
floor_setup
->
data
.
t1
.
class_dimensions
[
floor_setup
->
data
.
t1
.
partition_class
[
j
]];
++
k
,
++
floor1_values
)
{
floor_setup
->
data
.
t1
.
list
[
floor1_values
].
x
=
get_bits
(
gb
,
rangebits
);
AV_DEBUG
(
" %u. floor1 Y coord. %d
\n
"
,
floor1_values
,
av_dlog
(
NULL
,
" %u. floor1 Y coord. %d
\n
"
,
floor1_values
,
floor_setup
->
data
.
t1
.
list
[
floor1_values
].
x
);
}
}
...
...
@@ -609,23 +609,23 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
return
-
1
;
#ifdef V_DEBUG
/* debug output parsed headers */
AV_DEBUG
(
"floor0 order: %u
\n
"
,
floor_setup
->
data
.
t0
.
order
);
AV_DEBUG
(
"floor0 rate: %u
\n
"
,
floor_setup
->
data
.
t0
.
rate
);
AV_DEBUG
(
"floor0 bark map size: %u
\n
"
,
/* debug output parsed headers */
av_dlog
(
NULL
,
"floor0 order: %u
\n
"
,
floor_setup
->
data
.
t0
.
order
);
av_dlog
(
NULL
,
"floor0 rate: %u
\n
"
,
floor_setup
->
data
.
t0
.
rate
);
av_dlog
(
NULL
,
"floor0 bark map size: %u
\n
"
,
floor_setup
->
data
.
t0
.
bark_map_size
);
AV_DEBUG
(
"floor0 amplitude bits: %u
\n
"
,
av_dlog
(
NULL
,
"floor0 amplitude bits: %u
\n
"
,
floor_setup
->
data
.
t0
.
amplitude_bits
);
AV_DEBUG
(
"floor0 amplitude offset: %u
\n
"
,
av_dlog
(
NULL
,
"floor0 amplitude offset: %u
\n
"
,
floor_setup
->
data
.
t0
.
amplitude_offset
);
AV_DEBUG
(
"floor0 number of books: %u
\n
"
,
av_dlog
(
NULL
,
"floor0 number of books: %u
\n
"
,
floor_setup
->
data
.
t0
.
num_books
);
AV_DEBUG
(
"floor0 book list pointer: %p
\n
"
,
av_dlog
(
NULL
,
"floor0 book list pointer: %p
\n
"
,
floor_setup
->
data
.
t0
.
book_list
);
{
int
idx
;
for
(
idx
=
0
;
idx
<
floor_setup
->
data
.
t0
.
num_books
;
++
idx
)
{
AV_DEBUG
(
" Book %d: %u
\n
"
,
idx
+
1
,
av_dlog
(
NULL
,
" Book %d: %u
\n
"
,
idx
+
1
,
floor_setup
->
data
.
t0
.
book_list
[
idx
]);
}
}
...
...
@@ -648,7 +648,7 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
vc
->
residue_count
=
get_bits
(
gb
,
6
)
+
1
;
vc
->
residues
=
av_mallocz
(
vc
->
residue_count
*
sizeof
(
*
vc
->
residues
));
AV_DEBUG
(
" There are %d residues.
\n
"
,
vc
->
residue_count
);
av_dlog
(
NULL
,
" There are %d residues.
\n
"
,
vc
->
residue_count
);
for
(
i
=
0
;
i
<
vc
->
residue_count
;
++
i
)
{
vorbis_residue
*
res_setup
=
&
vc
->
residues
[
i
];
...
...
@@ -657,7 +657,7 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
res_setup
->
type
=
get_bits
(
gb
,
16
);
AV_DEBUG
(
" %u. residue type %d
\n
"
,
i
,
res_setup
->
type
);
av_dlog
(
NULL
,
" %u. residue type %d
\n
"
,
i
,
res_setup
->
type
);
res_setup
->
begin
=
get_bits
(
gb
,
24
);
res_setup
->
end
=
get_bits
(
gb
,
24
);
...
...
@@ -684,7 +684,8 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
if
(
!
res_setup
->
classifs
)
return
AVERROR
(
ENOMEM
);
AV_DEBUG
(
" begin %d end %d part.size %d classif.s %d classbook %d
\n
"
,
res_setup
->
begin
,
res_setup
->
end
,
res_setup
->
partition_size
,
av_dlog
(
NULL
,
" begin %d end %d part.size %d classif.s %d classbook %d
\n
"
,
res_setup
->
begin
,
res_setup
->
end
,
res_setup
->
partition_size
,
res_setup
->
classifications
,
res_setup
->
classbook
);
for
(
j
=
0
;
j
<
res_setup
->
classifications
;
++
j
)
{
...
...
@@ -694,7 +695,7 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
high_bits
=
get_bits
(
gb
,
5
);
cascade
[
j
]
=
(
high_bits
<<
3
)
+
low_bits
;
AV_DEBUG
(
" %u class cascade depth: %d
\n
"
,
j
,
ilog
(
cascade
[
j
]));
av_dlog
(
NULL
,
" %u class cascade depth: %d
\n
"
,
j
,
ilog
(
cascade
[
j
]));
}
res_setup
->
maxpass
=
0
;
...
...
@@ -703,7 +704,7 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
if
(
cascade
[
j
]
&
(
1
<<
k
))
{
GET_VALIDATED_INDEX
(
res_setup
->
books
[
j
][
k
],
8
,
vc
->
codebook_count
)
AV_DEBUG
(
" %u class cascade depth %u book: %d
\n
"
,
av_dlog
(
NULL
,
" %u class cascade depth %u book: %d
\n
"
,
j
,
k
,
res_setup
->
books
[
j
][
k
]);
if
(
k
>
res_setup
->
maxpass
)
...
...
@@ -727,7 +728,7 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
vc
->
mapping_count
=
get_bits
(
gb
,
6
)
+
1
;
vc
->
mappings
=
av_mallocz
(
vc
->
mapping_count
*
sizeof
(
*
vc
->
mappings
));
AV_DEBUG
(
" There are %d mappings.
\n
"
,
vc
->
mapping_count
);
av_dlog
(
NULL
,
" There are %d mappings.
\n
"
,
vc
->
mapping_count
);
for
(
i
=
0
;
i
<
vc
->
mapping_count
;
++
i
)
{
vorbis_mapping
*
mapping_setup
=
&
vc
->
mappings
[
i
];
...
...
@@ -756,7 +757,7 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
mapping_setup
->
coupling_steps
=
0
;
}
AV_DEBUG
(
" %u mapping coupling steps: %d
\n
"
,
av_dlog
(
NULL
,
" %u mapping coupling steps: %d
\n
"
,
i
,
mapping_setup
->
coupling_steps
);
if
(
get_bits
(
gb
,
2
))
{
...
...
@@ -776,8 +777,7 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
GET_VALIDATED_INDEX
(
mapping_setup
->
submap_floor
[
j
],
8
,
vc
->
floor_count
)
GET_VALIDATED_INDEX
(
mapping_setup
->
submap_residue
[
j
],
8
,
vc
->
residue_count
)
AV_DEBUG
(
" %u mapping %u submap : floor %d, residue %d
\n
"
,
i
,
j
,
av_dlog
(
NULL
,
" %u mapping %u submap : floor %d, residue %d
\n
"
,
i
,
j
,
mapping_setup
->
submap_floor
[
j
],
mapping_setup
->
submap_residue
[
j
]);
}
...
...
@@ -816,8 +816,7 @@ static void create_map(vorbis_context *vc, unsigned floor_number)
#ifdef V_DEBUG
for
(
idx
=
0
;
idx
<=
n
;
++
idx
)
{
AV_DEBUG
(
"floor0 map: map at pos %d is %d
\n
"
,
idx
,
map
[
idx
]);
av_dlog
(
NULL
,
"floor0 map: map at pos %d is %d
\n
"
,
idx
,
map
[
idx
]);
}
#endif
}
...
...
@@ -830,7 +829,7 @@ static int vorbis_parse_setup_hdr_modes(vorbis_context *vc)
vc
->
mode_count
=
get_bits
(
gb
,
6
)
+
1
;
vc
->
modes
=
av_mallocz
(
vc
->
mode_count
*
sizeof
(
*
vc
->
modes
));
AV_DEBUG
(
" There are %d modes.
\n
"
,
vc
->
mode_count
);
av_dlog
(
NULL
,
" There are %d modes.
\n
"
,
vc
->
mode_count
);
for
(
i
=
0
;
i
<
vc
->
mode_count
;
++
i
)
{
vorbis_mode
*
mode_setup
=
&
vc
->
modes
[
i
];
...
...
@@ -840,7 +839,7 @@ static int vorbis_parse_setup_hdr_modes(vorbis_context *vc)
mode_setup
->
transformtype
=
get_bits
(
gb
,
16
);
//FIXME check
GET_VALIDATED_INDEX
(
mode_setup
->
mapping
,
8
,
vc
->
mapping_count
);
AV_DEBUG
(
" %u mode: blockflag %d, windowtype %d, transformtype %d, mapping %d
\n
"
,
av_dlog
(
NULL
,
" %u mode: blockflag %d, windowtype %d, transformtype %d, mapping %d
\n
"
,
i
,
mode_setup
->
blockflag
,
mode_setup
->
windowtype
,
mode_setup
->
transformtype
,
mode_setup
->
mapping
);
}
...
...
@@ -950,7 +949,7 @@ static int vorbis_parse_id_hdr(vorbis_context *vc)
ff_mdct_init
(
&
vc
->
mdct
[
0
],
bl0
,
1
,
-
vc
->
scale_bias
);
ff_mdct_init
(
&
vc
->
mdct
[
1
],
bl1
,
1
,
-
vc
->
scale_bias
);
AV_DEBUG
(
" vorbis version %d
\n
audio_channels %d
\n
audio_samplerate %d
\n
bitrate_max %d
\n
bitrate_nom %d
\n
bitrate_min %d
\n
blk_0 %d blk_1 %d
\n
"
,
av_dlog
(
NULL
,
" vorbis version %d
\n
audio_channels %d
\n
audio_samplerate %d
\n
bitrate_max %d
\n
bitrate_nom %d
\n
bitrate_min %d
\n
blk_0 %d blk_1 %d
\n
"
,
vc
->
version
,
vc
->
audio_channels
,
vc
->
audio_samplerate
,
vc
->
bitrate_maximum
,
vc
->
bitrate_nominal
,
vc
->
bitrate_minimum
,
vc
->
blocksize
[
0
],
vc
->
blocksize
[
1
]);
/*
...
...
@@ -1058,7 +1057,7 @@ static int vorbis_floor0_decode(vorbis_context *vc,
"floor0 dec: booknumber too high!
\n
"
);
book_idx
=
0
;
}
AV_DEBUG
(
"floor0 dec: booknumber: %u
\n
"
,
book_idx
);
av_dlog
(
NULL
,
"floor0 dec: booknumber: %u
\n
"
,
book_idx
);
codebook
=
vc
->
codebooks
[
vf
->
book_list
[
book_idx
]];
/* Invalid codebook! */
if
(
!
codebook
.
codevectors
)
...
...
@@ -1067,13 +1066,13 @@ static int vorbis_floor0_decode(vorbis_context *vc,
while
(
lsp_len
<
vf
->
order
)
{
int
vec_off
;
AV_DEBUG
(
"floor0 dec: book dimension: %d
\n
"
,
codebook
.
dimensions
);
AV_DEBUG
(
"floor0 dec: maximum depth: %d
\n
"
,
codebook
.
maxdepth
);
av_dlog
(
NULL
,
"floor0 dec: book dimension: %d
\n
"
,
codebook
.
dimensions
);
av_dlog
(
NULL
,
"floor0 dec: maximum depth: %d
\n
"
,
codebook
.
maxdepth
);
/* read temp vector */
vec_off
=
get_vlc2
(
&
vc
->
gb
,
codebook
.
vlc
.
table
,
codebook
.
nb_bits
,
codebook
.
maxdepth
)
*
codebook
.
dimensions
;
AV_DEBUG
(
"floor0 dec: vector offset: %d
\n
"
,
vec_off
);
av_dlog
(
NULL
,
"floor0 dec: vector offset: %d
\n
"
,
vec_off
);
/* copy each vector component and add last to it */
for
(
idx
=
0
;
idx
<
codebook
.
dimensions
;
++
idx
)
lsp
[
lsp_len
+
idx
]
=
codebook
.
codevectors
[
vec_off
+
idx
]
+
last
;
...
...
@@ -1086,7 +1085,7 @@ static int vorbis_floor0_decode(vorbis_context *vc,
{
int
idx
;
for
(
idx
=
0
;
idx
<
lsp_len
;
++
idx
)
AV_DEBUG
(
"floor0 dec: coeff at %d is %f
\n
"
,
idx
,
lsp
[
idx
]);
av_dlog
(
NULL
,
"floor0 dec: coeff at %d is %f
\n
"
,
idx
,
lsp
[
idx
]);
}
#endif
...
...
@@ -1141,7 +1140,7 @@ static int vorbis_floor0_decode(vorbis_context *vc,
return
1
;
}
AV_DEBUG
(
" Floor0 decoded
\n
"
);
av_dlog
(
NULL
,
" Floor0 decoded
\n
"
);
return
0
;
}
...
...
@@ -1168,7 +1167,7 @@ static int vorbis_floor1_decode(vorbis_context *vc,
floor1_Y
[
0
]
=
get_bits
(
gb
,
ilog
(
range
-
1
));
floor1_Y
[
1
]
=
get_bits
(
gb
,
ilog
(
range
-
1
));
AV_DEBUG
(
"floor 0 Y %d floor 1 Y %d
\n
"
,
floor1_Y
[
0
],
floor1_Y
[
1
]);
av_dlog
(
NULL
,
"floor 0 Y %d floor 1 Y %d
\n
"
,
floor1_Y
[
0
],
floor1_Y
[
1
]);
offset
=
2
;
for
(
i
=
0
;
i
<
vf
->
partitions
;
++
i
)
{
...
...
@@ -1178,7 +1177,7 @@ static int vorbis_floor1_decode(vorbis_context *vc,
csub
=
(
1
<<
cbits
)
-
1
;
cval
=
0
;
AV_DEBUG
(
"Cbits %u
\n
"
,
cbits
);
av_dlog
(
NULL
,
"Cbits %u
\n
"
,
cbits
);
if
(
cbits
)
// this reads all subclasses for this partition's class
cval
=
get_vlc2
(
gb
,
vc
->
codebooks
[
vf
->
class_masterbook
[
class
]].
vlc
.
table
,
...
...
@@ -1187,7 +1186,7 @@ static int vorbis_floor1_decode(vorbis_context *vc,
for
(
j
=
0
;
j
<
cdim
;
++
j
)
{
book
=
vf
->
subclass_books
[
class
][
cval
&
csub
];
AV_DEBUG
(
"book %d Cbits %u cval %u bits:%d
\n
"
,
av_dlog
(
NULL
,
"book %d Cbits %u cval %u bits:%d
\n
"
,
book
,
cbits
,
cval
,
get_bits_count
(
gb
));
cval
=
cval
>>
cbits
;
...
...
@@ -1198,7 +1197,8 @@ static int vorbis_floor1_decode(vorbis_context *vc,
floor1_Y
[
offset
+
j
]
=
0
;
}
AV_DEBUG
(
" floor(%d) = %d
\n
"
,
vf
->
list
[
offset
+
j
].
x
,
floor1_Y
[
offset
+
j
]);
av_dlog
(
NULL
,
" floor(%d) = %d
\n
"
,
vf
->
list
[
offset
+
j
].
x
,
floor1_Y
[
offset
+
j
]);
}
offset
+=
cdim
;
}
...
...
@@ -1256,7 +1256,7 @@ static int vorbis_floor1_decode(vorbis_context *vc,
floor1_Y_final
[
i
]
=
predicted
;
}
AV_DEBUG
(
" Decoded floor(%d) = %u / val %u
\n
"
,
av_dlog
(
NULL
,
" Decoded floor(%d) = %u / val %u
\n
"
,
vf
->
list
[
i
].
x
,
floor1_Y_final
[
i
],
val
);
}
...
...
@@ -1264,7 +1264,7 @@ static int vorbis_floor1_decode(vorbis_context *vc,
ff_vorbis_floor1_render_list
(
vf
->
list
,
vf
->
x_list_dim
,
floor1_Y_final
,
floor1_flag
,
vf
->
multiplier
,
vec
,
vf
->
list
[
1
].
x
);
AV_DEBUG
(
" Floor decoded
\n
"
);
av_dlog
(
NULL
,
" Floor decoded
\n
"
);
return
0
;
}
...
...
@@ -1295,7 +1295,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
ch_used
=
ch
;
}
AV_DEBUG
(
" residue type 0/1/2 decode begin, ch: %d cpc %d
\n
"
,
ch
,
c_p_c
);
av_dlog
(
NULL
,
" residue type 0/1/2 decode begin, ch: %d cpc %d
\n
"
,
ch
,
c_p_c
);
for
(
pass
=
0
;
pass
<=
vr
->
maxpass
;
++
pass
)
{
// FIXME OPTIMIZE?
uint16_t
voffset
,
partition_count
,
j_times_ptns_to_read
;
...
...
@@ -1309,7 +1309,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
unsigned
temp
=
get_vlc2
(
gb
,
vc
->
codebooks
[
vr
->
classbook
].
vlc
.
table
,
vc
->
codebooks
[
vr
->
classbook
].
nb_bits
,
3
);
AV_DEBUG
(
"Classword: %u
\n
"
,
temp
);
av_dlog
(
NULL
,
"Classword: %u
\n
"
,
temp
);
assert
(
vr
->
classifications
>
1
&&
temp
<=
65536
);
//needed for inverse[]
for
(
i
=
0
;
i
<
c_p_c
;
++
i
)
{
...
...
@@ -1354,7 +1354,8 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
for
(
l
=
0
;
l
<
dim
;
++
l
,
++
voffs
)
{
vec
[
voffs
]
+=
codebook
.
codevectors
[
coffs
+
l
];
// FPMATH
AV_DEBUG
(
" pass %d offs: %d curr: %f change: %f cv offs.: %d
\n
"
,
pass
,
voffs
,
vec
[
voffs
],
codebook
.
codevectors
[
coffs
+
l
],
coffs
);
av_dlog
(
NULL
,
" pass %d offs: %d curr: %f change: %f cv offs.: %d
\n
"
,
pass
,
voffs
,
vec
[
voffs
],
codebook
.
codevectors
[
coffs
+
l
],
coffs
);
}
}
}
else
if
(
vr_type
==
2
&&
ch
==
2
&&
(
voffset
&
1
)
==
0
&&
(
dim
&
1
)
==
0
)
{
// most frequent case optimized
...
...
@@ -1381,7 +1382,10 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
vec
[
voffs
]
+=
codebook
.
codevectors
[
coffs
+
l
];
// FPMATH
vec
[
voffs
+
vlen
]
+=
codebook
.
codevectors
[
coffs
+
l
+
1
];
// FPMATH
AV_DEBUG
(
" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d
\n
"
,
pass
,
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
,
vec
[
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
],
codebook
.
codevectors
[
coffs
+
l
],
coffs
,
l
);
av_dlog
(
NULL
,
" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d
\n
"
,
pass
,
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
,
vec
[
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
],
codebook
.
codevectors
[
coffs
+
l
],
coffs
,
l
);
}
}
...
...
@@ -1393,7 +1397,10 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
for
(
l
=
0
;
l
<
dim
;
++
l
,
++
voffs
)
{
vec
[
voffs
/
ch
+
(
voffs
%
ch
)
*
vlen
]
+=
codebook
.
codevectors
[
coffs
+
l
];
// FPMATH FIXME use if and counter instead of / and %
AV_DEBUG
(
" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d
\n
"
,
pass
,
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
,
vec
[
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
],
codebook
.
codevectors
[
coffs
+
l
],
coffs
,
l
);
av_dlog
(
NULL
,
" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d
\n
"
,
pass
,
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
,
vec
[
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
],
codebook
.
codevectors
[
coffs
+
l
],
coffs
,
l
);
}
}
}
...
...
@@ -1481,7 +1488,7 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
vc
->
mode_number
=
mode_number
;
mapping
=
&
vc
->
mappings
[
vc
->
modes
[
mode_number
].
mapping
];
AV_DEBUG
(
" Mode number: %u , mapping: %d , blocktype %d
\n
"
,
mode_number
,
av_dlog
(
NULL
,
" Mode number: %u , mapping: %d , blocktype %d
\n
"
,
mode_number
,
vc
->
modes
[
mode_number
].
mapping
,
vc
->
modes
[
mode_number
].
blockflag
);
blockflag
=
vc
->
modes
[
mode_number
].
blockflag
;
...
...
@@ -1611,7 +1618,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext,
if
(
!
buf_size
)
return
0
;
AV_DEBUG
(
"packet length %d
\n
"
,
buf_size
);
av_dlog
(
NULL
,
"packet length %d
\n
"
,
buf_size
);
init_get_bits
(
gb
,
buf
,
buf_size
*
8
);
...
...
@@ -1628,7 +1635,8 @@ static int vorbis_decode_frame(AVCodecContext *avccontext,
return
buf_size
;
}
AV_DEBUG
(
"parsed %d bytes %d bits, returned %d samples (*ch*bits)
\n
"
,
get_bits_count
(
gb
)
/
8
,
get_bits_count
(
gb
)
%
8
,
len
);
av_dlog
(
NULL
,
"parsed %d bytes %d bits, returned %d samples (*ch*bits)
\n
"
,
get_bits_count
(
gb
)
/
8
,
get_bits_count
(
gb
)
%
8
,
len
);
if
(
vc
->
audio_channels
>
8
)
{
for
(
i
=
0
;
i
<
vc
->
audio_channels
;
i
++
)
...
...
libavcodec/vqavideo.c
View file @
df96f22d
...
...
@@ -90,14 +90,6 @@
#define CPLZ_TAG MKBETAG('C', 'P', 'L', 'Z')
#define VPTZ_TAG MKBETAG('V', 'P', 'T', 'Z')
#define VQA_DEBUG 0
#if VQA_DEBUG
#define vqa_debug printf
#else
static
inline
void
vqa_debug
(
const
char
*
format
,
...)
{
}
#endif
typedef
struct
VqaContext
{
AVCodecContext
*
avctx
;
...
...
@@ -212,7 +204,7 @@ static void decode_format80(const unsigned char *src, int src_size,
while
(
src_index
<
src_size
)
{
vqa_debug
(
" opcode %02X: "
,
src
[
src_index
]);
av_dlog
(
NULL
,
" opcode %02X: "
,
src
[
src_index
]);
/* 0x80 means that frame is finished */
if
(
src
[
src_index
]
==
0x80
)
...
...
@@ -231,7 +223,7 @@ static void decode_format80(const unsigned char *src, int src_size,
src_index
+=
2
;
src_pos
=
AV_RL16
(
&
src
[
src_index
]);
src_index
+=
2
;
vqa_debug
(
"(1) copy %X bytes from absolute pos %X
\n
"
,
count
,
src_pos
);
av_dlog
(
NULL
,
"(1) copy %X bytes from absolute pos %X
\n
"
,
count
,
src_pos
);
CHECK_COUNT
();
for
(
i
=
0
;
i
<
count
;
i
++
)
dest
[
dest_index
+
i
]
=
dest
[
src_pos
+
i
];
...
...
@@ -243,7 +235,7 @@ static void decode_format80(const unsigned char *src, int src_size,
count
=
AV_RL16
(
&
src
[
src_index
]);
src_index
+=
2
;
color
=
src
[
src_index
++
];
vqa_debug
(
"(2) set %X bytes to %02X
\n
"
,
count
,
color
);
av_dlog
(
NULL
,
"(2) set %X bytes to %02X
\n
"
,
count
,
color
);
CHECK_COUNT
();
memset
(
&
dest
[
dest_index
],
color
,
count
);
dest_index
+=
count
;
...
...
@@ -253,7 +245,7 @@ static void decode_format80(const unsigned char *src, int src_size,
count
=
(
src
[
src_index
++
]
&
0x3F
)
+
3
;
src_pos
=
AV_RL16
(
&
src
[
src_index
]);
src_index
+=
2
;
vqa_debug
(
"(3) copy %X bytes from absolute pos %X
\n
"
,
count
,
src_pos
);
av_dlog
(
NULL
,
"(3) copy %X bytes from absolute pos %X
\n
"
,
count
,
src_pos
);
CHECK_COUNT
();
for
(
i
=
0
;
i
<
count
;
i
++
)
dest
[
dest_index
+
i
]
=
dest
[
src_pos
+
i
];
...
...
@@ -262,7 +254,7 @@ static void decode_format80(const unsigned char *src, int src_size,
}
else
if
(
src
[
src_index
]
>
0x80
)
{
count
=
src
[
src_index
++
]
&
0x3F
;
vqa_debug
(
"(4) copy %X bytes from source to dest
\n
"
,
count
);
av_dlog
(
NULL
,
"(4) copy %X bytes from source to dest
\n
"
,
count
);
CHECK_COUNT
();
memcpy
(
&
dest
[
dest_index
],
&
src
[
src_index
],
count
);
src_index
+=
count
;
...
...
@@ -273,7 +265,7 @@ static void decode_format80(const unsigned char *src, int src_size,
count
=
((
src
[
src_index
]
&
0x70
)
>>
4
)
+
3
;
src_pos
=
AV_RB16
(
&
src
[
src_index
])
&
0x0FFF
;
src_index
+=
2
;
vqa_debug
(
"(5) copy %X bytes from relpos %X
\n
"
,
count
,
src_pos
);
av_dlog
(
NULL
,
"(5) copy %X bytes from relpos %X
\n
"
,
count
,
src_pos
);
CHECK_COUNT
();
for
(
i
=
0
;
i
<
count
;
i
++
)
dest
[
dest_index
+
i
]
=
dest
[
dest_index
-
src_pos
+
i
];
...
...
libavformat/ipmovie.c
View file @
df96f22d
...
...
@@ -35,17 +35,6 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
/* debugging support: #define DEBUG_IPMOVIE as non-zero to see extremely
* verbose information about the demux process */
#define DEBUG_IPMOVIE 0
#if DEBUG_IPMOVIE
#undef printf
#define debug_ipmovie printf
#else
static
inline
void
debug_ipmovie
(
const
char
*
format
,
...)
{
}
#endif
#define CHUNK_PREAMBLE_SIZE 4
#define OPCODE_PREAMBLE_SIZE 4
...
...
@@ -150,7 +139,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
s
->
audio_frame_count
+=
(
s
->
audio_chunk_size
-
6
)
/
s
->
audio_channels
;
debug_ipmovie
(
"sending audio frame with pts %"
PRId64
" (%d audio frames)
\n
"
,
av_dlog
(
NULL
,
"sending audio frame with pts %"
PRId64
" (%d audio frames)
\n
"
,
pkt
->
pts
,
s
->
audio_frame_count
);
chunk_type
=
CHUNK_VIDEO
;
...
...
@@ -195,8 +184,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
pkt
->
stream_index
=
s
->
video_stream_index
;
pkt
->
pts
=
s
->
video_pts
;
debug_ipmovie
(
"sending video frame with pts %"
PRId64
"
\n
"
,
pkt
->
pts
);
av_dlog
(
NULL
,
"sending video frame with pts %"
PRId64
"
\n
"
,
pkt
->
pts
);
s
->
video_pts
+=
s
->
frame_pts_inc
;
...
...
@@ -244,36 +232,36 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
chunk_size
=
AV_RL16
(
&
chunk_preamble
[
0
]);
chunk_type
=
AV_RL16
(
&
chunk_preamble
[
2
]);
debug_ipmovie
(
"chunk type 0x%04X, 0x%04X bytes: "
,
chunk_type
,
chunk_size
);
av_dlog
(
NULL
,
"chunk type 0x%04X, 0x%04X bytes: "
,
chunk_type
,
chunk_size
);
switch
(
chunk_type
)
{
case
CHUNK_INIT_AUDIO
:
debug_ipmovie
(
"initialize audio
\n
"
);
av_dlog
(
NULL
,
"initialize audio
\n
"
);
break
;
case
CHUNK_AUDIO_ONLY
:
debug_ipmovie
(
"audio only
\n
"
);
av_dlog
(
NULL
,
"audio only
\n
"
);
break
;
case
CHUNK_INIT_VIDEO
:
debug_ipmovie
(
"initialize video
\n
"
);
av_dlog
(
NULL
,
"initialize video
\n
"
);
break
;
case
CHUNK_VIDEO
:
debug_ipmovie
(
"video (and audio)
\n
"
);
av_dlog
(
NULL
,
"video (and audio)
\n
"
);
break
;
case
CHUNK_SHUTDOWN
:
debug_ipmovie
(
"shutdown
\n
"
);
av_dlog
(
NULL
,
"shutdown
\n
"
);
break
;
case
CHUNK_END
:
debug_ipmovie
(
"end
\n
"
);
av_dlog
(
NULL
,
"end
\n
"
);
break
;
default:
debug_ipmovie
(
"invalid chunk
\n
"
);
av_dlog
(
NULL
,
"invalid chunk
\n
"
);
chunk_type
=
CHUNK_BAD
;
break
;
...
...
@@ -299,29 +287,29 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
chunk_size
-=
OPCODE_PREAMBLE_SIZE
;
chunk_size
-=
opcode_size
;
if
(
chunk_size
<
0
)
{
debug_ipmovie
(
"chunk_size countdown just went negative
\n
"
);
av_dlog
(
NULL
,
"chunk_size countdown just went negative
\n
"
);
chunk_type
=
CHUNK_BAD
;
break
;
}
debug_ipmovie
(
" opcode type %02X, version %d, 0x%04X bytes: "
,
av_dlog
(
NULL
,
" opcode type %02X, version %d, 0x%04X bytes: "
,
opcode_type
,
opcode_version
,
opcode_size
);
switch
(
opcode_type
)
{
case
OPCODE_END_OF_STREAM
:
debug_ipmovie
(
"end of stream
\n
"
);
av_dlog
(
NULL
,
"end of stream
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_END_OF_CHUNK
:
debug_ipmovie
(
"end of chunk
\n
"
);
av_dlog
(
NULL
,
"end of chunk
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_CREATE_TIMER
:
debug_ipmovie
(
"create timer
\n
"
);
av_dlog
(
NULL
,
"create timer
\n
"
);
if
((
opcode_version
>
0
)
||
(
opcode_size
>
6
))
{
debug_ipmovie
(
"bad create_timer opcode
\n
"
);
av_dlog
(
NULL
,
"bad create_timer opcode
\n
"
);
chunk_type
=
CHUNK_BAD
;
break
;
}
...
...
@@ -331,14 +319,15 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
break
;
}
s
->
frame_pts_inc
=
((
uint64_t
)
AV_RL32
(
&
scratch
[
0
]))
*
AV_RL16
(
&
scratch
[
4
]);
debug_ipmovie
(
" %.2f frames/second (timer div = %d, subdiv = %d)
\n
"
,
1000000
.
0
/
s
->
frame_pts_inc
,
AV_RL32
(
&
scratch
[
0
]),
AV_RL16
(
&
scratch
[
4
]));
av_dlog
(
NULL
,
" %.2f frames/second (timer div = %d, subdiv = %d)
\n
"
,
1000000
.
0
/
s
->
frame_pts_inc
,
AV_RL32
(
&
scratch
[
0
]),
AV_RL16
(
&
scratch
[
4
]));
break
;
case
OPCODE_INIT_AUDIO_BUFFERS
:
debug_ipmovie
(
"initialize audio buffers
\n
"
);
av_dlog
(
NULL
,
"initialize audio buffers
\n
"
);
if
((
opcode_version
>
1
)
||
(
opcode_size
>
10
))
{
debug_ipmovie
(
"bad init_audio_buffers opcode
\n
"
);
av_dlog
(
NULL
,
"bad init_audio_buffers opcode
\n
"
);
chunk_type
=
CHUNK_BAD
;
break
;
}
...
...
@@ -360,23 +349,22 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
s
->
audio_type
=
CODEC_ID_PCM_S16LE
;
else
s
->
audio_type
=
CODEC_ID_PCM_U8
;
debug_ipmovie
(
"audio: %d bits, %d Hz, %s, %s format
\n
"
,
s
->
audio_bits
,
s
->
audio_sample_rate
,
av_dlog
(
NULL
,
"audio: %d bits, %d Hz, %s, %s format
\n
"
,
s
->
audio_bits
,
s
->
audio_sample_rate
,
(
s
->
audio_channels
==
2
)
?
"stereo"
:
"mono"
,
(
s
->
audio_type
==
CODEC_ID_INTERPLAY_DPCM
)
?
"Interplay audio"
:
"PCM"
);
break
;
case
OPCODE_START_STOP_AUDIO
:
debug_ipmovie
(
"start/stop audio
\n
"
);
av_dlog
(
NULL
,
"start/stop audio
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_INIT_VIDEO_BUFFERS
:
debug_ipmovie
(
"initialize video buffers
\n
"
);
av_dlog
(
NULL
,
"initialize video buffers
\n
"
);
if
((
opcode_version
>
2
)
||
(
opcode_size
>
8
))
{
debug_ipmovie
(
"bad init_video_buffers opcode
\n
"
);
av_dlog
(
NULL
,
"bad init_video_buffers opcode
\n
"
);
chunk_type
=
CHUNK_BAD
;
break
;
}
...
...
@@ -392,7 +380,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
}
else
{
s
->
video_bpp
=
16
;
}
debug_ipmovie
(
"video resolution: %d x %d
\n
"
,
av_dlog
(
NULL
,
"video resolution: %d x %d
\n
"
,
s
->
video_width
,
s
->
video_height
);
break
;
...
...
@@ -403,17 +391,17 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
case
OPCODE_UNKNOWN_13
:
case
OPCODE_UNKNOWN_14
:
case
OPCODE_UNKNOWN_15
:
debug_ipmovie
(
"unknown (but documented) opcode %02X
\n
"
,
opcode_type
);
av_dlog
(
NULL
,
"unknown (but documented) opcode %02X
\n
"
,
opcode_type
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_SEND_BUFFER
:
debug_ipmovie
(
"send buffer
\n
"
);
av_dlog
(
NULL
,
"send buffer
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_AUDIO_FRAME
:
debug_ipmovie
(
"audio frame
\n
"
);
av_dlog
(
NULL
,
"audio frame
\n
"
);
/* log position and move on for now */
s
->
audio_chunk_offset
=
avio_tell
(
pb
);
...
...
@@ -422,26 +410,26 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
break
;
case
OPCODE_SILENCE_FRAME
:
debug_ipmovie
(
"silence frame
\n
"
);
av_dlog
(
NULL
,
"silence frame
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_INIT_VIDEO_MODE
:
debug_ipmovie
(
"initialize video mode
\n
"
);
av_dlog
(
NULL
,
"initialize video mode
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_CREATE_GRADIENT
:
debug_ipmovie
(
"create gradient
\n
"
);
av_dlog
(
NULL
,
"create gradient
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_SET_PALETTE
:
debug_ipmovie
(
"set palette
\n
"
);
av_dlog
(
NULL
,
"set palette
\n
"
);
/* check for the logical maximum palette size
* (3 * 256 + 4 bytes) */
if
(
opcode_size
>
0x304
)
{
debug_ipmovie
(
"demux_ipmovie: set_palette opcode too large
\n
"
);
av_dlog
(
NULL
,
"demux_ipmovie: set_palette opcode too large
\n
"
);
chunk_type
=
CHUNK_BAD
;
break
;
}
...
...
@@ -455,7 +443,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
last_color
=
first_color
+
AV_RL16
(
&
scratch
[
2
])
-
1
;
/* sanity check (since they are 16 bit values) */
if
((
first_color
>
0xFF
)
||
(
last_color
>
0xFF
))
{
debug_ipmovie
(
"demux_ipmovie: set_palette indexes out of range (%d -> %d)
\n
"
,
av_dlog
(
NULL
,
"demux_ipmovie: set_palette indexes out of range (%d -> %d)
\n
"
,
first_color
,
last_color
);
chunk_type
=
CHUNK_BAD
;
break
;
...
...
@@ -473,12 +461,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
break
;
case
OPCODE_SET_PALETTE_COMPRESSED
:
debug_ipmovie
(
"set palette compressed
\n
"
);
av_dlog
(
NULL
,
"set palette compressed
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_SET_DECODING_MAP
:
debug_ipmovie
(
"set decoding map
\n
"
);
av_dlog
(
NULL
,
"set decoding map
\n
"
);
/* log position and move on for now */
s
->
decode_map_chunk_offset
=
avio_tell
(
pb
);
...
...
@@ -487,7 +475,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
break
;
case
OPCODE_VIDEO_DATA
:
debug_ipmovie
(
"set video data
\n
"
);
av_dlog
(
NULL
,
"set video data
\n
"
);
/* log position and move on for now */
s
->
video_chunk_offset
=
avio_tell
(
pb
);
...
...
@@ -496,7 +484,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
break
;
default:
debug_ipmovie
(
"*** unknown opcode type
\n
"
);
av_dlog
(
NULL
,
"*** unknown opcode type
\n
"
);
chunk_type
=
CHUNK_BAD
;
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment