diff --exclude='#*#' --exclude='*.orig' --exclude='*.rej' --exclude='*~' --exclude='Makefile*' --exclude='*svn*' --exclude='moc_*.cpp' -rNu ../decoderlocking/mythplugins/mythmusic/mythmusic/goom/mythgoom.cpp mythplugins/mythmusic/mythmusic/goom/mythgoom.cpp
old
|
new
|
|
78 | 78 | return true; |
79 | 79 | |
80 | 80 | int numSamps = 512; |
| 81 | int step = 1; |
| 82 | |
81 | 83 | if (node->length < 512) |
82 | | numSamps = node->length; |
| 84 | step = 512 / node->length; |
83 | 85 | |
84 | 86 | signed short int data[2][512]; |
85 | 87 | |
86 | 88 | int i = 0; |
87 | | for (i = 0; i < numSamps; i++) |
| 89 | for (i = 0; i < numSamps; i += step) |
88 | 90 | { |
89 | 91 | data[0][i] = node->left[i]; |
90 | 92 | if (node->right) |
91 | 93 | data[1][i] = node->right[i]; |
92 | 94 | else |
93 | 95 | data[1][i] = data[0][i]; |
| 96 | |
| 97 | if (step > 1) |
| 98 | for (int j = 1; j < step; j++) |
| 99 | { |
| 100 | data[0][i+j] = data[0][i]; |
| 101 | data[1][i+j] = data[1][i]; |
| 102 | } |
94 | 103 | } |
95 | 104 | |
96 | 105 | for (; i < 512; i++) |
diff --exclude='#*#' --exclude='*.orig' --exclude='*.rej' --exclude='*~' --exclude='Makefile*' --exclude='*svn*' --exclude='moc_*.cpp' -rNu ../decoderlocking/mythplugins/mythmusic/mythmusic/inlines.h mythplugins/mythmusic/mythmusic/inlines.h
old
|
new
|
|
11 | 11 | |
12 | 12 | // *fast* convenience functions |
13 | 13 | |
| 14 | static inline void smoothen_mono(short *in_data, short *out_data, int len, int new_len) |
| 15 | { |
| 16 | int step = new_len/len; |
| 17 | int dii = 0; |
| 18 | for (int ii = 0; ii < len; ii++) |
| 19 | { |
| 20 | out_data[dii] = in_data[ii]; |
| 21 | |
| 22 | short smooth = 0; |
| 23 | |
| 24 | if (ii < len-1) |
| 25 | smooth = in_data[ii+1] - in_data[ii]; |
| 26 | |
| 27 | if (smooth) |
| 28 | smooth /= step; |
| 29 | |
| 30 | for (int cc = 1; cc < step; cc++) { |
| 31 | out_data[dii+cc] = out_data[dii+cc-1] + smooth; |
| 32 | } |
| 33 | |
| 34 | dii += step; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | static inline void smoothen_stereo(short *l_in_data, short *l_out_data, |
| 39 | short *r_in_data, short *r_out_data, |
| 40 | int len, int new_len) |
| 41 | { |
| 42 | int step = new_len/len; |
| 43 | int dii = 0; |
| 44 | for (int ii = 0; ii < len; ii++) |
| 45 | { |
| 46 | l_out_data[dii] = l_in_data[ii]; |
| 47 | r_out_data[dii] = r_in_data[ii]; |
| 48 | |
| 49 | short l_smooth = 0; |
| 50 | short r_smooth = 0; |
| 51 | |
| 52 | if (ii < len-1) { |
| 53 | l_smooth = l_in_data[ii+1] - l_in_data[ii]; |
| 54 | r_smooth = r_in_data[ii+1] - r_in_data[ii]; |
| 55 | } |
| 56 | |
| 57 | if (l_smooth) |
| 58 | l_smooth /= step; |
| 59 | |
| 60 | if (r_smooth) |
| 61 | r_smooth /= step; |
| 62 | |
| 63 | for (int cc = 1; cc < step; cc++) { |
| 64 | l_out_data[dii+cc] = l_out_data[dii+cc-1] + l_smooth; |
| 65 | r_out_data[dii+cc] = r_out_data[dii+cc-1] + r_smooth; |
| 66 | } |
| 67 | |
| 68 | dii += step; |
| 69 | } |
| 70 | } |
| 71 | |
14 | 72 | static inline void stereo16_from_stereopcm8(register short *l, |
15 | 73 | register short *r, |
16 | 74 | register uchar *c, |
diff --exclude='#*#' --exclude='*.orig' --exclude='*.rej' --exclude='*~' --exclude='Makefile*' --exclude='*svn*' --exclude='moc_*.cpp' -rNu ../decoderlocking/mythplugins/mythmusic/mythmusic/mainvisual.cpp mythplugins/mythmusic/mythmusic/mainvisual.cpp
old
|
new
|
|
229 | 229 | else |
230 | 230 | len = 0; |
231 | 231 | |
| 232 | if (len < 512) |
| 233 | { |
| 234 | short *new_l = 0; |
| 235 | short *new_r = 0; |
| 236 | |
| 237 | if (c == 1) |
| 238 | { |
| 239 | new_l = new short[512]; |
| 240 | smoothen_mono(l, new_l, len, 512); |
| 241 | delete r; |
| 242 | delete l; |
| 243 | r = new_r; |
| 244 | l = new_l; |
| 245 | } |
| 246 | |
| 247 | if (c == 2) |
| 248 | { |
| 249 | new_l = new short[512]; |
| 250 | new_r = new short[512]; |
| 251 | smoothen_stereo(l, new_l, r, new_r, len, 512); |
| 252 | delete r; |
| 253 | delete l; |
| 254 | r = new_r; |
| 255 | l = new_l; |
| 256 | } |
| 257 | |
| 258 | len = 512; |
| 259 | } |
| 260 | |
232 | 261 | nodes.append(new VisualNode(l, r, len, w)); |
233 | 262 | } |
234 | 263 | |
… |
… |
|
401 | 430 | long s, indexTo; |
402 | 431 | double *magnitudesp = magnitudes.data(); |
403 | 432 | double valL, valR, tmpL, tmpR; |
404 | | double index, step = 512.0 / size.width(); |
405 | 433 | |
406 | 434 | if (node) { |
407 | | index = 0; |
| 435 | double step = (node->length < 512 ? node->length : 512.0) / size.width(); |
| 436 | double index = 0; |
408 | 437 | for ( i = 0; i < size.width(); i++) { |
409 | 438 | indexTo = (int)(index + step); |
410 | 439 | if (indexTo == (int)(index)) |
… |
… |
|
600 | 629 | double *magnitudesp = magnitudes.data(); |
601 | 630 | double val, tmp; |
602 | 631 | |
603 | | double index, step = 512.0 / size.width(); |
604 | | |
605 | 632 | if (node) |
606 | 633 | { |
607 | | index = 0; |
| 634 | double step = (node->length < 512 ? node->length : 512.0) / size.width(); |
| 635 | double index = 0; |
608 | 636 | for ( i = 0; i < size.width(); i++) |
609 | 637 | { |
610 | 638 | indexTo = (int)(index + step); |