ref: 4d75f855f36e72d0270e6de9c181bb660b8e0991
parent: 8075157982bfd8923324d0070cae455ce01b6f85
author: Timothy B. Terriberry <[email protected]>
date: Wed Aug 28 20:55:49 EDT 2013
Minor simplification to end-trimming logic. This is a little easier to read, and allows us to save some subtractions and a comparison.
--- a/src/opusfile.c
+++ b/src/opusfile.c
@@ -2712,12 +2712,12 @@
od_buffer_pos=(int)OP_MIN(trimmed_duration,cur_discard_count);
cur_discard_count-=od_buffer_pos;
_of->cur_discard_count=cur_discard_count;
- if(OP_UNLIKELY(od_buffer_pos>0)
- &&OP_LIKELY(od_buffer_pos<trimmed_duration)){
+ trimmed_duration-=od_buffer_pos;
+ if(OP_LIKELY(trimmed_duration>0)
+ &&OP_UNLIKELY(od_buffer_pos>0)){
memmove(_pcm,_pcm+od_buffer_pos*nchannels,
- sizeof(*_pcm)*(trimmed_duration-od_buffer_pos)*nchannels);
+ sizeof(*_pcm)*trimmed_duration*nchannels);
}
- trimmed_duration-=od_buffer_pos;
/*Update bitrate tracking based on the actual samples we used from
what was decoded.*/
_of->bytes_tracked+=pop->bytes;