Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(522943)

Delta Between Two Patch Sets: src/opusdec.c

Issue 1358: Dithering improvement
Left Patch Set: new filters Created 2 years ago
Right Patch Set: oops Created 2 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* Copyright (c) 2002-2007 Jean-Marc Valin 1 /* Copyright (c) 2002-2007 Jean-Marc Valin
2 Copyright (c) 2008 CSIRO 2 Copyright (c) 2008 CSIRO
3 Copyright (c) 2007-2013 Xiph.Org Foundation 3 Copyright (c) 2007-2013 Xiph.Org Foundation
4 File: opusdec.c 4 File: opusdec.c
5 5
6 Redistribution and use in source and binary forms, with or without 6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions 7 modification, are permitted provided that the following conditions
8 are met: 8 are met:
9 9
10 - Redistributions of source code must retain the above copyright 10 - Redistributions of source code must retain the above copyright
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 by the peak error of 1.5 +20 dB though this much is unobservable rare) 158 by the peak error of 1.5 +20 dB though this much is unobservable rare)
159 so to avoid clipping the signal is attenuated by a couple thousandths 159 so to avoid clipping the signal is attenuated by a couple thousandths
160 of a dB. Initially the approach taken here was to only attenuate by 160 of a dB. Initially the approach taken here was to only attenuate by
161 the 99.9th percentile, making clipping rare but not impossible (like 161 the 99.9th percentile, making clipping rare but not impossible (like
162 SoX) but the limited gain of the filter means that the worst case was 162 SoX) but the limited gain of the filter means that the worst case was
163 only two thousandths of a dB more, so this just uses the worst case. 163 only two thousandths of a dB more, so this just uses the worst case.
164 The attenuation is probably also helpful to prevent clipping in the DAC 164 The attenuation is probably also helpful to prevent clipping in the DAC
165 reconstruction filters or downstream resampling in any case.*/ 165 reconstruction filters or downstream resampling in any case.*/
166 static inline void shape_dither_toshort(shapestate *_ss, short *_o, float *_i, i nt _n, int _CC) 166 static inline void shape_dither_toshort(shapestate *_ss, short *_o, float *_i, i nt _n, int _CC)
167 { 167 {
168 const float fcoef[3][8] = 168 const float fcoef[2][8] =
169 { 169 {
170 {2.2374f, -.7339f, -.1251f, -.6033f, 0.9030f, .0116f, -.5853f, -.2571f}, /* 48.0kHz noise shaping filter sd=2.34*/ 170 {2.2374f, -.7339f, -.1251f, -.6033f, 0.9030f, .0116f, -.5853f, -.2571f}, /* 48.0kHz noise shaping filter sd=2.34*/
171 {2.2061f, -.4706f, -.2534f, -.6214f, 1.0587f, .0676f, -.6054f, -.2738f}, /* 44.1kHz noise shaping filter sd=2.51*/ 171 {2.2061f, -.4706f, -.2534f, -.6214f, 1.0587f, .0676f, -.6054f, -.2738f}, /* 44.1kHz noise shaping filter sd=2.51*/
172 }; 172 };
173 float coef[8]={0}; 173 float coef[8]={0};
174 int i; 174 int i;
175 float *b_buf; 175 float *b_buf;
176 float *a_buf; 176 float *a_buf;
177 float fs = _ss->fs; 177 float fs = _ss->fs;
178 int dither=0; 178 int dither=0;
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 if (fout != NULL) 1150 if (fout != NULL)
1151 fclose(fout); 1151 fclose(fout);
1152 1152
1153 #ifdef WIN_UNICODE 1153 #ifdef WIN_UNICODE
1154 free_commandline_arguments_utf8(&argc_utf8, &argv_utf8); 1154 free_commandline_arguments_utf8(&argc_utf8, &argv_utf8);
1155 uninit_console_utf8(); 1155 uninit_console_utf8();
1156 #endif 1156 #endif
1157 1157
1158 return 0; 1158 return 0;
1159 } 1159 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

RSS Feeds Recent Issues | This issue
This is Rietveld