Skip to content

Commit

Permalink
fix decode errors
Browse files Browse the repository at this point in the history
  • Loading branch information
af-slh committed May 27, 2023
1 parent 120b067 commit 77d01e6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
22 changes: 11 additions & 11 deletions src/libsac/libsac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ void FrameCoder::PredictStereoFrame(const SacProfile &profile,int ch0,int ch1,in
Predictor::tparam param;
SetParam(param,profile,optimize);
Predictor pr(param);
int lag=param.nS1;
int j=-lag;
//int lag=param.nS1;
//int j=-lag;

#if 1
#if 0
const int32_t minval=-(1<<15);
const int32_t maxval=(1<<15);

Expand Down Expand Up @@ -582,7 +582,7 @@ void FrameCoder::Optimize(SacProfile &profile,const std::vector<int>&params_to_o
#endif
}

#if 1
#if 0
std::cout << "\n[";
for (auto i:params_to_optimize)
std::cout << profile.coefs[i].vdef << ' ';
Expand Down Expand Up @@ -629,11 +629,11 @@ void FrameCoder::AnalyseMonoChannel(int ch, int numsamples)
}
framestats[ch].mean = (sum) / numsamples;

if (framestats[ch].mean > 0) {
/*if (framestats[ch].mean != 0) {
for (int i=0;i<numsamples;i++) src[i]-=framestats[ch].mean;
}
}*/


/*
int32_t minval = std::numeric_limits<int32_t>::max();
int32_t maxval = std::numeric_limits<int32_t>::min();
for (int i=0;i<numsamples;i++) {
Expand All @@ -643,7 +643,7 @@ void FrameCoder::AnalyseMonoChannel(int ch, int numsamples)
}
framestats[ch].minval = minval;
framestats[ch].maxval = maxval;
std::cout << framestats[ch].minval << ' ' << framestats[ch].maxval << '\n';*/
//std::cout << "stats: " << numsamples << " " << framestats[ch].minval << ' ' << framestats[ch].maxval << "\n\n";
}
}

Expand Down Expand Up @@ -677,12 +677,12 @@ void FrameCoder::Predict()
void FrameCoder::Unpredict()
{
if (numchannels_==2) UnpredictStereoFrame(baseprofile,0,1,numsamples_);
for (int ch=0;ch<numchannels_;ch++) {
if (framestats[ch].mean > 0) {
/*for (int ch=0;ch<numchannels_;ch++) {
if (framestats[ch].mean != 0) {
int32_t *dst=&(samples[ch][0]);
for (int i=0;i<numsamples_;i++) dst[i] += framestats[ch].mean;
}
}
}*/
//else for (int ch=0;ch<numchannels;ch++) UnpredictMonoFrame(ch,numsamples);
}

Expand Down
4 changes: 2 additions & 2 deletions src/libsac/libsac.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

class FrameCoder {
public:
const static int size_profile_bytes_normal=34*4;
const static int size_profile_bytes_high=42*4;
const static int size_profile_bytes_normal=35*4;
const static int size_profile_bytes_high=44*4;
struct coder_ctx {
enum SearchCost {L1,Entropy,Golomb,Bitplane};
enum SearchMethod {DDS,GRS};
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

int main(int argc,char *argv[])
{
std::cout << "Sac v0.6.2 - Lossless Audio Coder (c) Sebastian Lehmann\n";
std::cout << "Sac v0.6.3 - Lossless Audio Coder (c) Sebastian Lehmann\n";
std::cout << "compiled on " << __DATE__ << " ";
#ifdef __x86_64
std::cout << "(64-bit)";
Expand Down
1 change: 0 additions & 1 deletion src/opt/dds.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class DDS : public Opt {
std::cout << '\n';*/
}
nfunc++;
std::cout << "dds: " << nfunc << '\r';

This comment has been minimized.

Copy link
@MartinEesmaa

MartinEesmaa May 28, 2023

Contributor

Removing that line may not show DDS count number for unknown reason.
Update: After DDS count, it may be set wrong count combined together with samples. Example dds: 200/50000: 10.4%

This comment has been minimized.

Copy link
@slmdev

slmdev May 30, 2023

Owner

it was just a debug print

This comment has been minimized.

Copy link
@MartinEesmaa

MartinEesmaa May 30, 2023

Contributor

it was just a debug print

oh ok, thanks

}
return opt_ret{fbest,xbest};
}
Expand Down

0 comments on commit 77d01e6

Please sign in to comment.