Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
eaa8fb6d
Commit
eaa8fb6d
authored
Jun 28, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uint is not standard (and breaks Win32) - use unsigned
parent
1f03f5e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
37 deletions
+37
-37
modules/audio_filter/scaletempo.c
modules/audio_filter/scaletempo.c
+37
-37
No files found.
modules/audio_filter/scaletempo.c
View file @
eaa8fb6d
...
...
@@ -81,36 +81,36 @@ typedef struct aout_filter_sys_t
/* Filter static config */
double
scale
;
/* parameters */
u
int
ms_stride
;
u
nsigned
ms_stride
;
double
percent_overlap
;
u
int
ms_search
;
u
nsigned
ms_search
;
/* audio format */
u
int
samples_per_frame
;
/* AKA number of channels */
u
int
bytes_per_sample
;
u
int
bytes_per_frame
;
u
int
sample_rate
;
u
nsigned
samples_per_frame
;
/* AKA number of channels */
u
nsigned
bytes_per_sample
;
u
nsigned
bytes_per_frame
;
u
nsigned
sample_rate
;
/* stride */
double
frames_stride_scaled
;
double
frames_stride_error
;
u
int
bytes_stride
;
u
nsigned
bytes_stride
;
double
bytes_stride_scaled
;
u
int
bytes_queue_max
;
u
int
bytes_queued
;
u
int
bytes_to_slide
;
u
nsigned
bytes_queue_max
;
u
nsigned
bytes_queued
;
u
nsigned
bytes_to_slide
;
uint8_t
*
buf_queue
;
/* overlap */
u
int
samples_overlap
;
u
int
samples_standing
;
u
int
bytes_overlap
;
u
int
bytes_standing
;
u
nsigned
samples_overlap
;
u
nsigned
samples_standing
;
u
nsigned
bytes_overlap
;
u
nsigned
bytes_standing
;
void
*
buf_overlap
;
void
*
table_blend
;
void
(
*
output_overlap
)(
aout_filter_t
*
p_filter
,
void
*
p_out_buf
,
u
int
bytes_off
);
void
(
*
output_overlap
)(
aout_filter_t
*
p_filter
,
void
*
p_out_buf
,
u
nsigned
bytes_off
);
/* best overlap */
u
int
frames_search
;
u
nsigned
frames_search
;
void
*
buf_pre_corr
;
void
*
table_window
;
u
int
(
*
best_overlap_offset
)(
aout_filter_t
*
p_filter
);
u
nsigned
(
*
best_overlap_offset
)(
aout_filter_t
*
p_filter
);
/* for "audio filter" only, manage own buffers */
int
i_buf
;
uint8_t
*
p_buffers
[
2
];
...
...
@@ -119,13 +119,13 @@ typedef struct aout_filter_sys_t
/*****************************************************************************
* best_overlap_offset: calculate best offset for overlap
*****************************************************************************/
static
u
int
best_overlap_offset_float
(
aout_filter_t
*
p_filter
)
static
u
nsigned
best_overlap_offset_float
(
aout_filter_t
*
p_filter
)
{
aout_filter_sys_t
*
p
=
p_filter
->
p_sys
;
float
*
pw
,
*
po
,
*
ppc
,
*
search_start
;
float
best_corr
=
INT_MIN
;
u
int
best_off
=
0
;
u
int
i
,
off
;
u
nsigned
best_off
=
0
;
u
nsigned
i
,
off
;
pw
=
p
->
table_window
;
po
=
p
->
buf_overlap
;
...
...
@@ -158,14 +158,14 @@ static uint best_overlap_offset_float( aout_filter_t *p_filter )
*****************************************************************************/
static
void
output_overlap_float
(
aout_filter_t
*
p_filter
,
void
*
buf_out
,
u
int
bytes_off
)
u
nsigned
bytes_off
)
{
aout_filter_sys_t
*
p
=
p_filter
->
p_sys
;
float
*
pout
=
buf_out
;
float
*
pb
=
p
->
table_blend
;
float
*
po
=
p
->
buf_overlap
;
float
*
pin
=
(
float
*
)(
p
->
buf_queue
+
bytes_off
);
u
int
i
;
u
nsigned
i
;
for
(
i
=
0
;
i
<
p
->
samples_overlap
;
i
++
)
{
*
pout
++
=
*
po
-
*
pb
++
*
(
*
po
-
*
pin
++
);
po
++
;
}
...
...
@@ -180,19 +180,19 @@ static size_t fill_queue( aout_filter_t *p_filter,
size_t
offset
)
{
aout_filter_sys_t
*
p
=
p_filter
->
p_sys
;
u
int
bytes_in
=
i_buffer
-
offset
;
u
nsigned
bytes_in
=
i_buffer
-
offset
;
size_t
offset_unchanged
=
offset
;
if
(
p
->
bytes_to_slide
>
0
)
{
if
(
p
->
bytes_to_slide
<
p
->
bytes_queued
)
{
u
int
bytes_in_move
=
p
->
bytes_queued
-
p
->
bytes_to_slide
;
u
nsigned
bytes_in_move
=
p
->
bytes_queued
-
p
->
bytes_to_slide
;
memmove
(
p
->
buf_queue
,
p
->
buf_queue
+
p
->
bytes_to_slide
,
bytes_in_move
);
p
->
bytes_to_slide
=
0
;
p
->
bytes_queued
=
bytes_in_move
;
}
else
{
u
int
bytes_in_skip
;
u
nsigned
bytes_in_skip
;
p
->
bytes_to_slide
-=
p
->
bytes_queued
;
bytes_in_skip
=
__MIN
(
p
->
bytes_to_slide
,
bytes_in
);
p
->
bytes_queued
=
0
;
...
...
@@ -203,7 +203,7 @@ static size_t fill_queue( aout_filter_t *p_filter,
}
if
(
bytes_in
>
0
)
{
u
int
bytes_in_copy
=
__MIN
(
p
->
bytes_queue_max
-
p
->
bytes_queued
,
bytes_in
);
u
nsigned
bytes_in_copy
=
__MIN
(
p
->
bytes_queue_max
-
p
->
bytes_queued
,
bytes_in
);
memcpy
(
p
->
buf_queue
+
p
->
bytes_queued
,
p_buffer
+
offset
,
bytes_in_copy
);
...
...
@@ -225,9 +225,9 @@ static size_t transform_buffer( aout_filter_t *p_filter,
aout_filter_sys_t
*
p
=
p_filter
->
p_sys
;
size_t
offset_in
=
fill_queue
(
p_filter
,
p_buffer
,
i_buffer
,
0
);
u
int
bytes_out
=
0
;
u
nsigned
bytes_out
=
0
;
while
(
p
->
bytes_queued
>=
p
->
bytes_queue_max
)
{
u
int
bytes_off
=
0
;
u
nsigned
bytes_off
=
0
;
// output stride
if
(
p
->
output_overlap
)
{
...
...
@@ -247,7 +247,7 @@ static size_t transform_buffer( aout_filter_t *p_filter,
p
->
buf_queue
+
bytes_off
+
p
->
bytes_stride
,
p
->
bytes_overlap
);
double
frames_to_slide
=
p
->
frames_stride_scaled
+
p
->
frames_stride_error
;
u
int
frames_to_stride_whole
=
(
int
)
frames_to_slide
;
u
nsigned
frames_to_stride_whole
=
(
int
)
frames_to_slide
;
p
->
bytes_to_slide
=
frames_to_stride_whole
*
p
->
bytes_per_frame
;
p
->
frames_stride_error
=
frames_to_slide
-
frames_to_stride_whole
;
...
...
@@ -268,7 +268,7 @@ static size_t calculate_output_buffer_size( aout_filter_t *p_filter,
int
bytes_to_out
=
bytes_in
+
p
->
bytes_queued
-
p
->
bytes_to_slide
;
if
(
bytes_to_out
>=
(
int
)
p
->
bytes_queue_max
)
{
/* while (total_buffered - stride_length * n >= queue_max) n++ */
bytes_out
=
p
->
bytes_stride
*
(
(
u
int
)(
bytes_out
=
p
->
bytes_stride
*
(
(
u
nsigned
)(
(
bytes_to_out
-
p
->
bytes_queue_max
+
/* rounding protection */
p
->
bytes_per_frame
)
/
p
->
bytes_stride_scaled
)
+
1
);
}
...
...
@@ -281,20 +281,20 @@ static size_t calculate_output_buffer_size( aout_filter_t *p_filter,
static
int
reinit_buffers
(
aout_filter_t
*
p_filter
)
{
aout_filter_sys_t
*
p
=
p_filter
->
p_sys
;
u
int
i
,
j
;
u
nsigned
i
,
j
;
u
int
frames_stride
=
p
->
ms_stride
*
p
->
sample_rate
/
1000
.
0
;
u
nsigned
frames_stride
=
p
->
ms_stride
*
p
->
sample_rate
/
1000
.
0
;
p
->
bytes_stride
=
frames_stride
*
p
->
bytes_per_frame
;
/* overlap */
u
int
frames_overlap
=
frames_stride
*
p
->
percent_overlap
;
u
nsigned
frames_overlap
=
frames_stride
*
p
->
percent_overlap
;
if
(
frames_overlap
<
1
)
{
/* if no overlap */
p
->
bytes_overlap
=
0
;
p
->
bytes_standing
=
p
->
bytes_stride
;
p
->
samples_standing
=
p
->
bytes_standing
/
p
->
bytes_per_sample
;
p
->
output_overlap
=
NULL
;
}
else
{
u
int
prev_overlap
=
p
->
bytes_overlap
;
u
nsigned
prev_overlap
=
p
->
bytes_overlap
;
p
->
bytes_overlap
=
frames_overlap
*
p
->
bytes_per_frame
;
p
->
samples_overlap
=
frames_overlap
*
p
->
samples_per_frame
;
p
->
bytes_standing
=
p
->
bytes_stride
-
p
->
bytes_overlap
;
...
...
@@ -323,7 +323,7 @@ static int reinit_buffers( aout_filter_t *p_filter )
if
(
p
->
frames_search
<
1
)
{
/* if no search */
p
->
best_overlap_offset
=
NULL
;
}
else
{
u
int
bytes_pre_corr
=
(
p
->
samples_overlap
-
p
->
samples_per_frame
)
*
4
;
/* sizeof (int32|float) */
u
nsigned
bytes_pre_corr
=
(
p
->
samples_overlap
-
p
->
samples_per_frame
)
*
4
;
/* sizeof (int32|float) */
p
->
buf_pre_corr
=
malloc
(
bytes_pre_corr
);
p
->
table_window
=
malloc
(
bytes_pre_corr
);
if
(
!
p
->
buf_pre_corr
||
!
p
->
table_window
)
{
...
...
@@ -339,13 +339,13 @@ static int reinit_buffers( aout_filter_t *p_filter )
p
->
best_overlap_offset
=
best_overlap_offset_float
;
}
u
int
new_size
=
(
p
->
frames_search
+
frames_stride
+
frames_overlap
)
*
p
->
bytes_per_frame
;
u
nsigned
new_size
=
(
p
->
frames_search
+
frames_stride
+
frames_overlap
)
*
p
->
bytes_per_frame
;
if
(
p
->
bytes_queued
>
new_size
)
{
if
(
p
->
bytes_to_slide
>
p
->
bytes_queued
)
{
p
->
bytes_to_slide
-=
p
->
bytes_queued
;
p
->
bytes_queued
=
0
;
}
else
{
u
int
new_queued
=
__MIN
(
p
->
bytes_queued
-
p
->
bytes_to_slide
,
new_size
);
u
nsigned
new_queued
=
__MIN
(
p
->
bytes_queued
-
p
->
bytes_to_slide
,
new_size
);
memmove
(
p
->
buf_queue
,
p
->
buf_queue
+
p
->
bytes_queued
-
new_queued
,
new_queued
);
...
...
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