Skip to content

Commit

Permalink
19.7.16.37: update and fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zvezdochiot committed Sep 11, 2019
1 parent 9b29d62 commit 90bbf9b
Show file tree
Hide file tree
Showing 22 changed files with 137 additions and 203 deletions.
2 changes: 1 addition & 1 deletion COPYING
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2015-2016 Robert Tari <robert.tari@gmail.com>
Copyright 2015-2019 Robert Tari <robert.tari@gmail.com>
Copyright 2012 Vladislav Goncharov <vl-g@yandex.ru>
Copyright 2011-2016 Maxim V.Anisiutkin <maxim.anisiutkin@gmail.com>

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ install: sacd
install -d $(DESTDIR)/usr/bin
install -m 0755 ./sacd $(DESTDIR)/usr/bin
install -d $(DESTDIR)/usr/share/man/man1
install -m 0644 ./sacd.1 $(DESTDIR)/usr/share/man/man1
install -m 0644 ./man/sacd.1 $(DESTDIR)/usr/share/man/man1

4 changes: 2 additions & 2 deletions debian/bzr-builder.manifest
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# bzr-builder format 0.3 deb-version {debupstream}.35
lp:sacd revid:robert@tari.in-20190321204133-oisihrfs7ks8d27f
# bzr-builder format 0.3 deb-version {debupstream}.37
lp:sacd revid:robert@tari.in-20190715223949-zxngtgvgo6zfxuvh
17 changes: 15 additions & 2 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
sacd (19.3.21.35~ubuntu19.04.1) disco; urgency=low
sacd (19.7.16.37~ubuntu19.04.1) disco; urgency=low

* Auto build.

-- Robert Tari <robert@tari.in> Thu, 21 Mar 2019 20:43:45 +0000
-- Robert Tari <robert@tari.in> Mon, 15 Jul 2019 22:42:36 +0000

sacd (19.7.16) xenial; urgency=medium

* Make sure aligned_alloc uses multiple of the alignment (LP: #1836478)

-- Robert Tari <robert@tari.in> Tue, 16 Jul 2019 00:34:52 +0200

sacd (19.5.3) xenial; urgency=medium

* Fixed uneven padding error in DSDIFF
* Some code refactoring

-- Robert Tari <robert@tari.in> Fri, 03 May 2019 12:08:47 +0200

sacd (19.3.21) xenial; urgency=medium

Expand Down
2 changes: 1 addition & 1 deletion debian/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Source: https://code.launchpad.net/~robert-tari/sacd/trunk
Files: *
Copyright: 2015-2019 Robert Tari <robert@tari.in>
2012 Vladislav Goncharov <vl-g@yandex.ru>
2011-2018 Maxim V.Anisiutkin <maxim.anisiutkin@gmail.com>
2011-2019 Maxim V.Anisiutkin <maxim.anisiutkin@gmail.com>
License: GPL-3.0+

Files: debian/*
Expand Down
7 changes: 4 additions & 3 deletions libdsd2pcm/dsd_pcm_util.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2015-2016 Robert Tari <robert@tari.in>
Copyright (c) 2015-2019 Robert Tari <robert@tari.in>
Copyright (c) 2011-2015 Maxim V.Anisiutkin <maxim.anisiutkin@gmail.com>
This file is part of SACD.
Expand Down Expand Up @@ -33,10 +33,11 @@ class DSDPCMUtil

static void* mem_alloc(size_t size)
{
size_t sizemem = (size_t)MEM_ALIGN * (size_t)((size + MEM_ALIGN - 1) / MEM_ALIGN);
#ifdef _ISOC11_SOURCE
void* memory = aligned_alloc(MEM_ALIGN, size);
void* memory = aligned_alloc(MEM_ALIGN, sizemem);
#else
void* memory = memalign(MEM_ALIGN, size);
void* memory = memalign(MEM_ALIGN, sizemem);
#endif

if (memory)
Expand Down
66 changes: 31 additions & 35 deletions libdstdec/coded_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
using the code for non MPEG-4 Audio conforming products. This copyright notice
must be included in all copies of derivative works.
Copyright © 2004-2016.
Copyright © 2004-2019.
This file is part of SACD.
Expand All @@ -64,9 +64,7 @@

#include "coded_table.h"

// CCP = Coding of Coefficients and Ptables
// Initialize the prediction order and coefficients for prediction filter used to predict the filter coefficients.
void CCodedTableBase::calcCCP()
CCodedTable::CCodedTable()
{
for (int i = 0; i < NROFFRICEMETHODS; i++)
{
Expand All @@ -75,36 +73,34 @@ void CCodedTableBase::calcCCP()
CPredCoef[i][j] = 0;
}
}
}

switch (TableType)
{
case T_FILTER:
CPredOrder[0] = 1;
CPredCoef[0][0] = -8;
CPredOrder[1] = 2;
CPredCoef[1][0] = -16;
CPredCoef[1][1] = 8;
CPredOrder[2] = 3;
CPredCoef[2][0] = -9;
CPredCoef[2][1] = -5;
CPredCoef[2][2] = 6;
#if NROFFRICEMETHODS == 4
CPredOrder[3] = 1;
CPredCoef[3][0] = 8;
#endif
break;
case T_PTABLE:
CPredOrder[0] = 1;
CPredCoef[0][0] = -8;
CPredOrder[1] = 2;
CPredCoef[1][0] = -16;
CPredCoef[1][1] = 8;
CPredOrder[2] = 3;
CPredCoef[2][0] = -24;
CPredCoef[2][1] = 24;
CPredCoef[2][2] = -8;
break;
default:
break;
}
CCodedTableF::CCodedTableF()
{
CPredOrder[0] = 1;
CPredCoef[0][0] = -8;
CPredOrder[1] = 2;
CPredCoef[1][0] = -16;
CPredCoef[1][1] = 8;
CPredOrder[2] = 3;
CPredCoef[2][0] = -9;
CPredCoef[2][1] = -5;
CPredCoef[2][2] = 6;
#if NROFFRICEMETHODS == 4
CPredOrder[3] = 1;
CPredCoef[3][0] = 8;
#endif
}

CCodedTableP::CCodedTableP()
{
CPredOrder[0] = 1;
CPredCoef[0][0] = -8;
CPredOrder[1] = 2;
CPredCoef[1][0] = -16;
CPredCoef[1][1] = 8;
CPredOrder[2] = 3;
CPredCoef[2][0] = -24;
CPredCoef[2][1] = 24;
CPredCoef[2][2] = -8;
}
24 changes: 13 additions & 11 deletions libdstdec/coded_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
using the code for non MPEG-4 Audio conforming products. This copyright notice
must be included in all copies of derivative works.
Copyright © 2004-2016.
Copyright © 2004-2019.
This file is part of SACD.
Expand All @@ -67,12 +67,11 @@

#include "dst_defs.h"

class CCodedTableBase
class CCodedTable
{

public:

int TableType; // FILTER or PTABLE: indicates contents
int StreamBits; // nr of bits all filters use in the stream
int CPredOrder[NROFFRICEMETHODS]; // Code_PredOrder[Method]
int CPredCoef[NROFPRICEMETHODS][MAXCPREDORDER]; // Code_PredCoef[Method][CoefNr]
Expand All @@ -81,22 +80,25 @@ class CCodedTableBase
int m[2 * MAX_CHANNELS][NROFFRICEMETHODS]; // m[Fir/PtabNr][Method]
int DataLenData[2 * MAX_CHANNELS]; // Fir/PtabDataLength[Fir/PtabNr]

void calcCCP();
CCodedTable();
};

class CCodedTable : public CCodedTableBase
{
int Data[2 * MAX_CHANNELS][MAX((1 << SIZE_CODEDPREDORDER) * SIZE_PREDCOEF, AC_BITS * AC_HISMAX)]; // Fir/PtabData[Fir/PtabNr][Index]
};

class CCodedTableF : public CCodedTableBase
class CCodedTableF : public CCodedTable
{
int Data[2 * MAX_CHANNELS][(1 << SIZE_CODEDPREDORDER) * SIZE_PREDCOEF]; // FirData[FirNr][Index]

public:

CCodedTableF();
};

class CCodedTableP : public CCodedTableBase
class CCodedTableP : public CCodedTable
{
int Data[2 * MAX_CHANNELS][AC_BITS * AC_HISMAX]; // PtabData[PtabNr][Index]

public:

CCodedTableP();
};

#endif
74 changes: 1 addition & 73 deletions libdstdec/dst_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
using the code for non MPEG-4 Audio conforming products. This copyright notice
must be included in all copies of derivative works.
Copyright © 2004-2016.
Copyright © 2004-2019.
This file is part of SACD.
Expand All @@ -70,7 +70,6 @@

CDSTDecoder::CDSTDecoder()
{
::memset(this, 0, sizeof(*this));
}

CDSTDecoder::~CDSTDecoder()
Expand All @@ -86,12 +85,7 @@ int CDSTDecoder::init(int channels, int fs44)
FrameHdr.NrOfBitsPerCh = FrameHdr.MaxFrameLen * 8;
FrameHdr.MaxNrOfFilters = 2 * FrameHdr.NrOfChannels;
FrameHdr.MaxNrOfPtables = 2 * FrameHdr.NrOfChannels;

FrameHdr.FrameNr = 0;
StrFilter.TableType = T_FILTER;
StrFilter.calcCCP();
StrPtable.TableType = T_PTABLE;
StrPtable.calcCCP();

return 0;
}
Expand Down Expand Up @@ -120,21 +114,6 @@ Predict += FilterTable[13][ChannelStatus[13]]; \
Predict += FilterTable[14][ChannelStatus[14]]; \
Predict += FilterTable[15][ChannelStatus[15]];

#define LT_RUN_FILTER_U(FilterTable, ChannelStatus) \
{ \
uint32_t Predict32; \
\
Predict32 = FilterTable[ 0][ChannelStatus[ 0]] | (FilterTable[ 1][ChannelStatus[ 1]] << 16); \
Predict32 += FilterTable[ 2][ChannelStatus[ 2]] | (FilterTable[ 3][ChannelStatus[ 3]] << 16); \
Predict32 += FilterTable[ 4][ChannelStatus[ 4]] | (FilterTable[ 5][ChannelStatus[ 5]] << 16); \
Predict32 += FilterTable[ 6][ChannelStatus[ 6]] | (FilterTable[ 7][ChannelStatus[ 7]] << 16); \
Predict32 += FilterTable[ 8][ChannelStatus[ 8]] | (FilterTable[ 9][ChannelStatus[ 9]] << 16); \
Predict32 += FilterTable[10][ChannelStatus[10]] | (FilterTable[11][ChannelStatus[11]] << 16); \
Predict32 += FilterTable[12][ChannelStatus[12]] | (FilterTable[13][ChannelStatus[13]] << 16); \
Predict32 += FilterTable[14][ChannelStatus[14]] | (FilterTable[15][ChannelStatus[15]] << 16); \
Predict = (Predict32 >> 16) + (Predict32 & 0xffff); \
}

int CDSTDecoder::decode(uint8_t* DSTFrame, int frameSize, uint8_t* DSDFrame)
{
int rv = 0;
Expand Down Expand Up @@ -358,42 +337,6 @@ void CDSTDecoder::LT_InitCoefTablesI(int16_t ICoefI[2 * MAX_CHANNELS][16][256])
}
}

void CDSTDecoder::LT_InitCoefTablesU(uint16_t ICoefU[2 * MAX_CHANNELS][16][256])
{
int FilterNr, FilterLength, TableNr, k, i, j;

for (FilterNr = 0; FilterNr < FrameHdr.NrOfFilters; FilterNr++)
{
FilterLength = FrameHdr.PredOrder[FilterNr];

for (TableNr = 0; TableNr < 16; TableNr++)
{
k = FilterLength - TableNr * 8;

if (k > 8)
{
k = 8;
}
else if (k < 0)
{
k = 0;
}

for (i = 0; i < 256; i++)
{
int cvalue = 0;

for (j = 0; j < k; j++)
{
cvalue += (int16_t)(((i >> j) & 1) * 2 - 1) * FrameHdr.ICoefA[FilterNr][TableNr * 8 + j];
}

ICoefU[FilterNr][TableNr][i] = (uint16_t)(cvalue + (1 << SIZE_PREDCOEF) * 8);
}
}
}
}

void CDSTDecoder::LT_InitStatus(uint8_t Status[MAX_CHANNELS][16])
{
int ChNr, TableNr;
Expand Down Expand Up @@ -428,18 +371,3 @@ int16_t CDSTDecoder::LT_RunFilterI(int16_t FilterTable[16][256], uint8_t Channel

return (int16_t)Predict;
}

int16_t CDSTDecoder::LT_RunFilterU(uint16_t FilterTable[16][256], uint8_t ChannelStatus[16])
{
uint32_t Predict32 = FilterTable[0][ChannelStatus[0]] | (FilterTable[1][ChannelStatus[1]] << 16);
Predict32 += FilterTable[2][ChannelStatus[2]] | (FilterTable[3][ChannelStatus[3]] << 16);
Predict32 += FilterTable[4][ChannelStatus[4]] | (FilterTable[5][ChannelStatus[5]] << 16);
Predict32 += FilterTable[6][ChannelStatus[6]] | (FilterTable[7][ChannelStatus[7]] << 16);
Predict32 += FilterTable[8][ChannelStatus[8]] | (FilterTable[9][ChannelStatus[9]] << 16);
Predict32 += FilterTable[10][ChannelStatus[10]] | (FilterTable[11][ChannelStatus[11]] << 16);
Predict32 += FilterTable[12][ChannelStatus[12]] | (FilterTable[13][ChannelStatus[13]] << 16);
Predict32 += FilterTable[14][ChannelStatus[14]] | (FilterTable[15][ChannelStatus[15]] << 16);
int Predict = (Predict32 >> 16) + (Predict32 & 0xffff);

return (int16_t)Predict;
}
3 changes: 1 addition & 2 deletions libdstdec/dst_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
using the code for non MPEG-4 Audio conforming products. This copyright notice
must be included in all copies of derivative works.
Copyright © 2004-2016.
Copyright © 2004-2019.
This file is part of SACD.
Expand Down Expand Up @@ -77,7 +77,6 @@
#define dst_memset(dst, val, size) ::memset(dst, val, size)

extern int log_printf(char* fmt, ...);
enum ETTable { T_FILTER, T_PTABLE };

class CSegment
{
Expand Down
3 changes: 1 addition & 2 deletions libsacd/sacd_disc.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright 2015-2019 Robert Tari <robert@tari.in>
Copyright 2011-2016 Maxim V.Anisiutkin <maxim.anisiutkin@gmail.com>
Copyright 2011-2019 Maxim V.Anisiutkin <maxim.anisiutkin@gmail.com>
This file is part of SACD.
Expand Down Expand Up @@ -343,7 +343,6 @@ void sacd_disc_t::getTrackDetails(uint32_t track_number, area_id_e area_id, Trac
cTrackDetails->strArtist = cAreaTrackText.track_type_performer.size() ? cAreaTrackText.track_type_performer : "Unknown Artist";
cTrackDetails->strTitle = cAreaTrackText.track_type_title;
cTrackDetails->nChannels = cArea->area_toc->channel_count;
cTrackDetails->nSampleRate = SACD_SAMPLING_FREQUENCY;
}

string sacd_disc_t::set_track(uint32_t track_number, area_id_e area_id, uint32_t offset)
Expand Down
4 changes: 2 additions & 2 deletions libsacd/sacd_disc.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright 2015-2019 Robert Tari <robert@tari.in>
Copyright 2011-2016 Maxim V.Anisiutkin <maxim.anisiutkin@gmail.com>
Copyright 2011-2019 Maxim V.Anisiutkin <maxim.anisiutkin@gmail.com>
This file is part of SACD.
Expand All @@ -26,7 +26,7 @@
#include "scarletbook.h"
#include "sacd_reader.h"

#define SACD_PSN_SIZE 2064
constexpr int SACD_PSN_SIZE = 2064;

using namespace std;

Expand Down
Loading

0 comments on commit 90bbf9b

Please sign in to comment.