jniemann66 / ReSampler

High quality command-line audio sample rate converter
GNU Lesser General Public License v2.1
160 stars 26 forks source link

hang after first stage in multiStage for android #13

Closed mgood7123 closed 5 years ago

jniemann66 commented 5 years ago

I have replicated this when SIMD vector FIR filter is deactivated in favor of the scalar FIR filter (which is currently the case for Android), It occurs when adding a new converter stage to the vector of converters using emplace_back. Not sure why just yet.

jniemann66 commented 5 years ago

Ok problem was to do with allocating / deallocating kernel phases in the polyphase FIR filter. With SSE2, there are 4 kernel phases With AVX, there are 8 kernel phases but with no SSE2/AVX vectorization (ie scalar calculations) , there should only be one kernel phase. to cut a long story short - needed to set numVecElements to 1 when in scalar mode. Just tidying up - should have a commit soon. Sorry about that - it also explains a long-standing bug I have had with the 32-bit / no-SSE version. duh !

mgood7123 commented 5 years ago

ok, just fixed up my repo and synced with yours (was a bit difficult to figure out how to do correctly as I was missing the latest commit from your repo even though I pulled from upstream), i may need to revert and repull to get squash the 3 "merge with master and fix empty cout value with no message" commits into a single commit however i am not comfortable with doing that as i dont want to accidentally mess up my repo's commit history

https://github.com/jniemann66/ReSampler/pull/16/files

(literally just replace https://github.com/jniemann66/ReSampler/blob/master/ReSampler.cpp#L180

            if (ci.outputFormat) {
#ifdef COMPILING_ON_ANDROID
                ANDROID_OUT("Changing output bit format to %s", ANDROID_STDTOC(ci.outBitFormat));
#else
                std::cout << ci.outBitFormat << std::endl;
#endif
            }
            else { // user-supplied bit format not valid; try choosing appropriate format
                determineBestBitFormat(ci.outBitFormat, ci.inputFilename, ci.outputFilename);
                ci.outputFormat = determineOutputFormat(outFileExt, ci.outBitFormat);
                if (ci.outputFormat) {
#ifdef COMPILING_ON_ANDROID
                    ANDROID_OUT("Changing output bit format to %s", ANDROID_STDTOC(ci.outBitFormat));
#else
                    std::cout << "Changing output bit format to " << ci.outBitFormat << std::endl;
#endif         
                }

with

            if (ci.outputFormat) {
                std::cout << "Changing output bit format to " << ci.outBitFormat << std::endl;
            }
            else { // user-supplied bit format not valid; try choosing appropriate format
                determineBestBitFormat(ci.outBitFormat, ci.inputFilename, ci.outputFilename);
                ci.outputFormat = determineOutputFormat(outFileExt, ci.outBitFormat);
                if (ci.outputFormat) {
                    std::cout << "Changing output bit format to " << ci.outBitFormat << std::endl;
                }

)

jniemann66 commented 5 years ago

I just updated master - should be good now :-)

mgood7123 commented 5 years ago

ok, so it is ready to test? or do you still have more work to do before i can pull and test?

jniemann66 commented 5 years ago

Yes - you should be able to test it now. (I still need to do the raw file input stuff, though ... )

mgood7123 commented 5 years ago

imma just refork this repo lol

jniemann66 commented 5 years ago

Sorry about the refork

mgood7123 commented 5 years ago

its ok, needed to clean up my commits anyway lol

mgood7123 commented 5 years ago

and im building now

mgood7123 commented 5 years ago

and it sucesfully builds (with 3 warnings)

In file included from C:\Users\konek\StudioProjects\libmedia\app\src\main\java\libmedia\resampler\ReSampler\ReSampler.cpp:75:
C:\Users\konek\StudioProjects\libmedia\app\src\main\java\libmedia\resampler\ReSampler/csv.h:128:17: warning: private field 'mode' is not used [-Wunused-private-field]
    CsvOpenMode mode;
                ^
In file included from C:\Users\konek\StudioProjects\libmedia\app\src\main\java\libmedia\resampler\ReSampler\ReSampler.cpp:80:
C:\Users\konek\StudioProjects\libmedia\app\src\main\java\libmedia\resampler\ReSampler/dsf.h:245:11: warning: private field 'mode' is not used [-Wunused-private-field]
        OpenMode mode;
                 ^
In file included from C:\Users\konek\StudioProjects\libmedia\app\src\main\java\libmedia\resampler\ReSampler\ReSampler.cpp:81:
C:\Users\konek\StudioProjects\libmedia\app\src\main\java\libmedia\resampler\ReSampler/dff.h:279:14: warning: private field 'mode' is not used [-Wunused-private-field]
        dffOpenMode mode;
                    ^
5 warnings generated. (2 are from #warning and warning: field 'LOG_PRIORITY' will be initialized after field 'LOG_TAG')