Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
flac
Commits
0014e41a
Commit
0014e41a
authored
Feb 01, 2007
by
Josh Coalson
Browse files
add support for passing frame size to analyzer; analyzer also print qlp coeffs
parent
90c693a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/flac/analyze.c
View file @
0014e41a
...
...
@@ -58,7 +58,7 @@ void flac__analyze_init(analysis_options aopts)
}
}
void
flac__analyze_frame
(
const
FLAC__Frame
*
frame
,
unsigned
frame_number
,
analysis_options
aopts
,
FILE
*
fout
)
void
flac__analyze_frame
(
const
FLAC__Frame
*
frame
,
unsigned
frame_number
,
unsigned
frame_bytes
,
analysis_options
aopts
,
FILE
*
fout
)
{
const
unsigned
channels
=
frame
->
header
.
channels
;
char
outfilename
[
1024
];
...
...
@@ -66,7 +66,7 @@ void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, analys
unsigned
i
,
channel
;
/* do the human-readable part first */
fprintf
(
fout
,
"frame=%u
\t
blocksize=%u
\t
sample_rate=%u
\t
channels=%u
\t
channel_assignment=%s
\n
"
,
frame_number
,
frame
->
header
.
blocksize
,
frame
->
header
.
sample_rate
,
channels
,
FLAC__ChannelAssignmentString
[
frame
->
header
.
channel_assignment
]);
fprintf
(
fout
,
"frame=%u
\
t
bits=%u
\
t
blocksize=%u
\t
sample_rate=%u
\t
channels=%u
\t
channel_assignment=%s
\n
"
,
frame_number
,
frame_bytes
*
8
,
frame
->
header
.
blocksize
,
frame
->
header
.
sample_rate
,
channels
,
FLAC__ChannelAssignmentString
[
frame
->
header
.
channel_assignment
]);
for
(
channel
=
0
;
channel
<
channels
;
channel
++
)
{
const
FLAC__Subframe
*
subframe
=
frame
->
subframes
+
channel
;
fprintf
(
fout
,
"
\t
subframe=%u
\t
wasted_bits=%u
\t
type=%s"
,
channel
,
subframe
->
wasted_bits
,
FLAC__SubframeTypeString
[
subframe
->
type
]);
...
...
@@ -95,6 +95,8 @@ void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, analys
case
FLAC__SUBFRAME_TYPE_LPC
:
FLAC__ASSERT
(
subframe
->
data
.
lpc
.
entropy_coding_method
.
type
==
FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE
);
fprintf
(
fout
,
"
\t
order=%u
\t
partition_order=%u
\t
qlp_coeff_precision=%u
\t
quantization_level=%d
\n
"
,
subframe
->
data
.
lpc
.
order
,
subframe
->
data
.
lpc
.
entropy_coding_method
.
data
.
partitioned_rice
.
order
,
subframe
->
data
.
lpc
.
qlp_coeff_precision
,
subframe
->
data
.
lpc
.
quantization_level
);
for
(
i
=
0
;
i
<
subframe
->
data
.
lpc
.
order
;
i
++
)
fprintf
(
fout
,
"
\t\t
qlp_coeff[%u]=%d
\n
"
,
i
,
subframe
->
data
.
lpc
.
qlp_coeff
[
i
]);
for
(
i
=
0
;
i
<
subframe
->
data
.
lpc
.
order
;
i
++
)
fprintf
(
fout
,
"
\t\t
warmup[%u]=%d
\n
"
,
i
,
subframe
->
data
.
lpc
.
warmup
[
i
]);
if
(
aopts
.
do_residual_text
)
{
...
...
src/flac/analyze.h
View file @
0014e41a
...
...
@@ -25,7 +25,7 @@ typedef struct {
}
analysis_options
;
void
flac__analyze_init
(
analysis_options
aopts
);
void
flac__analyze_frame
(
const
FLAC__Frame
*
frame
,
unsigned
frame_number
,
analysis_options
aopts
,
FILE
*
fout
);
void
flac__analyze_frame
(
const
FLAC__Frame
*
frame
,
unsigned
frame_number
,
unsigned
frame_bytes
,
analysis_options
aopts
,
FILE
*
fout
);
void
flac__analyze_finish
(
analysis_options
aopts
);
#endif
src/flac/decode.c
View file @
0014e41a
...
...
@@ -87,6 +87,9 @@ typedef struct {
unsigned
sample_rate
;
FLAC__uint32
channel_mask
;
/* these are used only in analyze mode */
FLAC__uint64
decode_position
;
FLAC__StreamDecoder
*
decoder
;
FILE
*
fout
;
...
...
@@ -280,6 +283,8 @@ FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__
d
->
sample_rate
=
0
;
d
->
channel_mask
=
0
;
d
->
decode_position
=
0
;
d
->
decoder
=
0
;
d
->
fout
=
0
;
/* initialized with an open file later if necessary */
...
...
@@ -858,7 +863,10 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder
print_stats
(
decoder_session
);
if
(
decoder_session
->
analysis_mode
)
{
flac__analyze_frame
(
frame
,
decoder_session
->
frame_counter
-
1
,
decoder_session
->
aopts
,
fout
);
FLAC__uint64
dpos
;
FLAC__stream_decoder_get_decode_position
(
decoder_session
->
decoder
,
&
dpos
);
flac__analyze_frame
(
frame
,
decoder_session
->
frame_counter
-
1
,
(
unsigned
)(
dpos
-
decoder_session
->
decode_position
),
decoder_session
->
aopts
,
fout
);
decoder_session
->
decode_position
=
dpos
;
}
else
if
(
!
decoder_session
->
test_only
)
{
if
(
shift
&&
!
decoder_session
->
replaygain
.
apply
)
{
...
...
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