Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge libmythfreesurround into libmyth/audio #911

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mythtv/.cppcheck-suppress
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*:*/filters/*
*:*/html/*
*:*/libs/libmythfreemheg/*
*:*/libs/libmythfreesurround/*
*:*/libs/libmythmpeg2/*
*:*/libs/libmythtv/visualisations/goom/*
*:*/programs/mythbackend/serviceHosts/*
Expand Down
1 change: 0 additions & 1 deletion mythtv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ set_target_properties(
mythbase
mythdvdnav
mythfreemheg
mythfreesurround
mythmetadata
mythmpeg2
mythprotoserver
Expand Down
13 changes: 1 addition & 12 deletions mythtv/docs/doxygen-architecture-document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ There are also a few simple \ref testing "testing shortcuts".
and some old UI widgets are implemented by libmyth.

This library depends on libav*, \ref libmythbase "libmythbase",
\ref libmythui "libmythui", \ref libmythupnp "libmythupnp"
and libmythfreesurround.
\ref libmythui "libmythui", and \ref libmythupnp "libmythupnp".

Any changes to this library's ABI may trigger a %MythTV binary version
change because the plugins depend on it.
Expand Down Expand Up @@ -155,16 +154,6 @@ There are also a few simple \ref testing "testing shortcuts".

This library does not depend on any of our libraries.

<dt>libmythfreesurround
<dd>Support for some multi-channel audio transforms.

This library does not depend on any of our libraries.

<dt>libmythnvctrl
<dd>Interface between X-windows and NVidia drivers.

This library does not depend on any of our libraries.

</dl>
The libmythmpeg2 library appears redundant with the system libsamplerate, but
libmpeg2 decodes MPEG-2 more quickly than ffmpeg on some systems, and
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
add_subdirectory(libmythbase)
add_subdirectory(libmythfreesurround)
add_subdirectory(libmythservicecontracts)
if(TARGET mythtv_mheg)
add_subdirectory(libmythfreemheg)
Expand Down
5 changes: 4 additions & 1 deletion mythtv/libs/libmyth/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ set(AUDIO_HEADERS_NOT_INSTALLED
audio/audiooutputdownmix.h
audio/audiooutputgraph.h
audio/audiooutputnull.h
audio/freesurround.h
audio/freesurround_decoder.h
audio/pink.h
audio/spdifencoder.h)

Expand All @@ -68,6 +70,8 @@ add_library(
audio/audiooutpututil.cpp
audio/audiosettings.cpp
audio/eldutils.cpp
audio/freesurround.cpp
audio/freesurround_decoder.cpp
audio/pink.cpp
audio/spdifencoder.cpp
audio/volumebase.cpp
Expand Down Expand Up @@ -178,7 +182,6 @@ target_link_libraries(
PUBLIC mythbase
mythui
mythupnp
mythfreesurround
mythbluray
PkgConfig::LIBAVCODEC
PkgConfig::LIBAVFORMAT
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/audiooutputbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
#include "libmythbase/compat.h"
#include "libmythbase/mythconfig.h"
#include "libmythbase/mythlogging.h"
#include "libmythfreesurround/freesurround.h"

#include "audiooutputbase.h"
#include "audiooutputdigitalencoder.h"
#include "audiooutputdownmix.h"
#include "audiooutpututil.h"
#include "freesurround.h"
#include "spdifencoder.h"

// AC3 encode currently disabled for Android
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "freesurround.h"

#include <algorithm>
#include <cstdio>
Expand All @@ -29,14 +30,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <list>
#include <map>

#include "libmythbase/compat.h"
#include "libmythbase/mythlogging.h"

#include "freesurround.h"
#include "el_processor.h"

#include <QString>
#include <QDateTime>

#include "freesurround_decoder.h"

// our default internal block size, in floats
static const unsigned default_block_size = SURROUND_BUFSIZE;
Expand Down Expand Up @@ -129,13 +127,6 @@ void FreeSurround::SetParams()
}
}

FreeSurround::fsurround_params::fsurround_params(int32_t center_width,
int32_t dimension) :
center_width(center_width),
dimension(dimension)
{
}

FreeSurround::~FreeSurround()
{
LOG(VB_AUDIO, LOG_DEBUG, QString("FreeSurround::~FreeSurround"));
Expand All @@ -154,10 +145,6 @@ uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels)
auto *samples = (float *)buffer;
// demultiplex

float **inputs = m_decoder->getInputBuffers();
float *lt = &inputs[0][ic];
float *rt = &inputs[1][ic];

if ((m_surroundMode != SurroundModePassive) && (ic+numFrames > bs))
{
numFrames = bs - ic;
Expand All @@ -180,6 +167,9 @@ uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels)
process = false;
break;
default:
float **inputs = m_decoder->getInputBuffers();
float *lt = &inputs[0][ic];
float *rt = &inputs[1][ic];
for (i=0; i<numFrames; i++)
*lt++ = *rt++ = *samples++;
process = true;
Expand Down Expand Up @@ -219,6 +209,9 @@ uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels)
process = false;
break;
default:
float **inputs = m_decoder->getInputBuffers();
float *lt = &inputs[0][ic];
float *rt = &inputs[1][ic];
for (i=0; i<numFrames; i++)
{
*lt++ = *samples++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef FREESURROUND_H
#define FREESURROUND_H

#include "libmythbase/compat.h" // instead of sys/types.h, for MinGW compatibility
#include <cstdint>

using uint = unsigned int;

static constexpr uint16_t SURROUND_BUFSIZE { 8192 };

class Q_DECL_EXPORT FreeSurround
class FreeSurround
{
public:
enum SurroundMode : std::uint8_t
Expand Down Expand Up @@ -61,16 +63,14 @@ class Q_DECL_EXPORT FreeSurround

// the changeable parameters
struct fsurround_params {
int32_t center_width; // presence of the center channel
int32_t dimension; // dimension
int32_t center_width { 100 }; // presence of the center channel
int32_t dimension { 0 }; // dimension
float coeff_a { 0.8165 }; // surround mixing coefficients
float coeff_b { 0.5774 }; // surround mixing coefficients
int32_t phasemode { 0 }; // phase shifting mode
int32_t steering { 1 }; // steering mode (0=simple, 1=linear)
int32_t front_sep { 100 }; // front stereo separation
int32_t rear_sep { 100 }; // rear stereo separation
// (default) constructor
explicit fsurround_params(int32_t center_width=100, int32_t dimension=0);
} m_params;

// additional settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "freesurround_decoder.h"

#include "el_processor.h"
#include <algorithm>
#include <array>
#include <cmath>
Expand Down Expand Up @@ -278,13 +278,6 @@ class fsurround_decoder::Impl {
} else {
// --- this is the old & simple steering mode ---

// calculate the amplitude/phase difference
float ampDiff = clamp_unit_mag((ampL+ampR < epsilon) ? 0 : (ampR-ampL) / (ampR+ampL));
float phaseDiff = phaseL - phaseR;
if (phaseDiff < -PI) phaseDiff += 2*PI;
if (phaseDiff > PI) phaseDiff -= 2*PI;
phaseDiff = abs(phaseDiff);

// determine sound field x-position
m_xFs[f] = ampDiff;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#ifndef EL_PROCESSOR_H
#define EL_PROCESSOR_H
#ifndef FREESURROUND_DECODER_H
#define FREESURROUND_DECODER_H

// the Free Surround decoder
class fsurround_decoder {
Expand Down
6 changes: 4 additions & 2 deletions mythtv/libs/libmyth/libmyth.pro
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ HEADERS += audio/audiooutputdigitalencoder.h audio/spdifencoder.h
HEADERS += audio/audiosettings.h audio/audiooutputsettings.h audio/pink.h
HEADERS += audio/volumebase.h audio/eldutils.h
HEADERS += audio/audiooutputgraph.h
HEADERS += audio/freesurround.h
HEADERS += audio/freesurround_decoder.h
HEADERS += backendselect.h dbsettings.h
HEADERS += langsettings.h
HEADERS +=
Expand All @@ -59,6 +61,8 @@ SOURCES += audio/audioconvert.cpp
SOURCES += audio/audiosettings.cpp audio/audiooutputsettings.cpp audio/pink.cpp
SOURCES += audio/volumebase.cpp audio/eldutils.cpp
SOURCES += audio/audiooutputgraph.cpp
SOURCES += audio/freesurround.cpp
SOURCES += audio/freesurround_decoder.cpp
SOURCES += backendselect.cpp dbsettings.cpp
SOURCES += langsettings.cpp
SOURCES +=
Expand All @@ -80,7 +84,6 @@ INCLUDEPATH += $${POSTINC}
LIBS += -L../libmythbase -lmythbase-$${LIBVERSION}
LIBS += -L../libmythui -lmythui-$${LIBVERSION}
LIBS += -L../libmythupnp -lmythupnp-$${LIBVERSION}
LIBS += -L../libmythfreesurround -lmythfreesurround-$${LIBVERSION}
LIBS += -L../../external/FFmpeg/libswresample -lmythswresample
LIBS += -L../../external/FFmpeg/libavutil -lmythavutil
LIBS += -L../../external/FFmpeg/libavcodec -lmythavcodec
Expand All @@ -97,7 +100,6 @@ LIBS += -L../libmythservicecontracts -lmythservicecontracts-$${LIBVERSIO
POST_TARGETDEPS += ../../external/FFmpeg/libswresample/$$avLibName(swresample)
POST_TARGETDEPS += ../../external/FFmpeg/libavutil/$$avLibName(avutil)
POST_TARGETDEPS += ../../external/FFmpeg/libavcodec/$$avLibName(avcodec)
POST_TARGETDEPS += ../libmythfreesurround/libmythfreesurround-$${MYTH_LIB_EXT}
}

# Install headers so that plugins can compile independently
Expand Down
14 changes: 0 additions & 14 deletions mythtv/libs/libmythfreesurround/CMakeLists.txt

This file was deleted.

24 changes: 0 additions & 24 deletions mythtv/libs/libmythfreesurround/libmythfreesurround.pro

This file was deleted.

1 change: 0 additions & 1 deletion mythtv/libs/libmythmetadata/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ target_link_libraries(
mythbase
mythui
mythservicecontracts
mythfreesurround
mythtv
myth)

Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythmetadata/libmythmetadata.pro
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ INCLUDEPATH += $${CONFIG_TAGLIB_INCLUDES}
LIBS += -L../libmythbase -lmythbase-$${LIBVERSION}
LIBS += -L../libmythui -lmythui-$${LIBVERSION}
LIBS += -L../libmythservicecontracts -lmythservicecontracts-$${LIBVERSION}
LIBS += -L../libmythfreesurround -lmythfreesurround-$${LIBVERSION}
LIBS += -L../../external/FFmpeg/libswresample -lmythswresample
LIBS += -L../../external/FFmpeg/libavutil -lmythavutil
LIBS += -L../../external/FFmpeg/libavcodec -lmythavcodec
Expand Down
3 changes: 1 addition & 2 deletions mythtv/libs/libs.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include (../settings.pro)
TEMPLATE = subdirs

# Libraries without dependencies
SUBDIRS += libmythfreesurround libmythbase
SUBDIRS += libmythbase
SUBDIRS += libmythservicecontracts
libmythservicecontracts.depends = libmythbase

Expand All @@ -16,7 +16,6 @@ SUBDIRS += libmythui libmythupnp libmyth
libmythui.depends = libmythbase
libmythupnp.depends = libmythbase libmythservicecontracts
libmyth.depends = libmythbase libmythui libmythupnp
libmyth.depends += libmythfreesurround

LIBMYTHTVDEPS = $$SUBDIRS

Expand Down
Loading