Skip to content

Commit

Permalink
add option instruction. add evaluation results.
Browse files Browse the repository at this point in the history
  • Loading branch information
aikiriao committed Aug 29, 2024
1 parent b5625df commit 3bd1629
Show file tree
Hide file tree
Showing 38 changed files with 161 additions and 2 deletions.
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,48 @@ cmake --build build
./srla -e INPUT.wav OUTPUT.srl
```

you can change compression mode by `-m` option.
#### Mode `-m`

You can change compression mode by `-m` option.
Following example encoding in maximum compression (but slow) option.

```bash
./srla -e -m 5 INPUT.wav OUTPUT.srl
./srla -e -m 16 INPUT.wav OUTPUT.srl
```
#### Max block size `-B`

You can change maximum block size by `-B` option.
Following example encoding with maximum block size be 4096 sample.

```bash
./srla -e -B 4096 INPUT.wav OUTPUT.srl
```

#### Number of divisions in block `-V`

You can change number of division by `-V` option. Number of division specifies search depth of optimal block division.
Following example encoding with number of divisions in block to be $2^{2} = 4$.

```bash
./srla -e -V 2 INPUT.wav OUTPUT.srl
```

### Decode

```bash
./srla -d INPUT.srl OUTPUT.wav
```
## Performance

We use [RWC music dataset](https://staff.aist.go.jp/m.goto/RWC-MDB/) for comparison.

### Decoding speed vs compression ratio

![Decoding speed vs compression rate](./evaluation/decodespeed_vs_compressionrate_8192_total.png)

### Encoding speed vs compression ratio

![Encoding speed vs compression rate](./evaluation/encodespeed_vs_compressionrate_8192_total.png)

## License

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
129 changes: 129 additions & 0 deletions evaluation/plot_codec_performance_graph.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
" コーデック評価グラフの作成 "
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from adjustText import adjust_text

# type3 font 回避(tex使用)
matplotlib.rcParams['text.usetex'] = True
matplotlib.rcParams['text.latex.preamble'] = '\\usepackage{sfmath}'
# フォントサイズ一括設定
matplotlib.rcParams["font.size"] = 12
matplotlib.rcParams['pgf.texsystem'] = 'lualatex'

OTHER_CODEC_LABEL_PREFIXES = ['FLAC', 'WavPack', 'TTA', 'Monkey\'s Audio', 'MPEG4-ALS', 'TAK']
COLORLIST = ['crimson', 'g', 'b', 'c', 'm', 'k', 'red', 'orange']
CATEGORIES = ['classic', 'genre', 'jazz', 'popular', 'right', 'total']

AVOID_LABEL_LIST = ['FLAC -0', 'WavPack -x4', 'WavPack -h -x4', 'WavPack -hh -x4', 'Monkey\'s Audio -c4000', 'MPEG4-ALS -b', 'MPEG4-ALS -7', 'TAK -p0e', 'TAK -p0', 'TAK -p1e', 'TAK -p1', 'TAK -p2e', 'TAK -p2', 'TAK -p3e', 'TAK -p3','TAK -p4e', 'TAK -p4']

def _is_avoid_label(label):
for content in AVOID_LABEL_LIST:
if label == content:
return True
return False

if __name__ == "__main__":
other_codecs_df = pd.read_csv('codec_comparison_summery_other_codecs.csv', index_col=0)
srla_codecs_df = pd.read_csv('codec_comparison_summery.csv', index_col=0)
avx2_srla_codecs_df = pd.read_csv('codec_comparison_summery_avx2.csv', index_col=0)

for block_size in [4096, 8192, 16384]:
# デコード速度 v.s. 圧縮率グラフ
for category in CATEGORIES:
texts = []
plt.cla()
# 他コーデック
for inx, cprefix in enumerate(OTHER_CODEC_LABEL_PREFIXES):
line = [[], []]
for label in other_codecs_df.keys():
if _is_avoid_label(label) is True:
continue
if label.startswith(cprefix):
decode_time = other_codecs_df.at[f'{category} mean decode time', label]
compress_rate = other_codecs_df.at[f'{category} mean compression rate', label]
texts.append(plt.text(decode_time, compress_rate, label[len(cprefix):], size=10))
line[0].append(decode_time)
line[1].append(compress_rate)
plt.plot(line[0], line[1], color=COLORLIST[inx], label=cprefix, marker='o')
# SRLA
for div_index, div in enumerate([0, 2]):
line = [[], []]
for label in srla_codecs_df.keys():
if label.startswith('SRLA'):
if not str(block_size) in label or not f'-V {div}' in label:
continue
option_prefix = label[len('SRLA'):label.index('V') - 1]
decode_time = srla_codecs_df.at[f'{category} mean decode time', label]
compress_rate = srla_codecs_df.at[f'{category} mean compression rate', label]
texts.append(plt.text(decode_time, compress_rate, option_prefix, size=10))
line[0].append(decode_time)
line[1].append(compress_rate)
plt.plot(line[0], line[1], color=COLORLIST[len(OTHER_CODEC_LABEL_PREFIXES) + div_index], label=f'SRLA V={div}', marker='^')
# AVX2 SRLA
for div_index, div in enumerate([0, 2]):
line = [[], []]
for label in avx2_srla_codecs_df.keys():
if label.startswith('SRLA'):
if not str(block_size) in label or not f'-V {div}' in label:
continue
option_prefix = label[len('SRLA'):label.index('V') - 1]
decode_time = avx2_srla_codecs_df.at[f'{category} mean decode time', label]
compress_rate = avx2_srla_codecs_df.at[f'{category} mean compression rate', label]
texts.append(plt.text(decode_time, compress_rate, option_prefix, size=10))
line[0].append(decode_time)
line[1].append(compress_rate)
plt.plot(line[0], line[1], color=COLORLIST[len(OTHER_CODEC_LABEL_PREFIXES) + div_index], label=f'AVX2 SRLA V={div}', marker='^', linestyle='--')

adjust_text(texts)
plt.title(f'Decoding speed v.s. compression rate for {category} blocksize:{block_size}')
plt.xlabel('Average decoding speed (\%)')
plt.ylabel('Average compression rate (\%)')
plt.legend(ncols=2)
plt.grid()
plt.xlim((0.1, 0.42))
if category == 'total':
plt.ylim(ymin=53.5)
plt.tight_layout()
plt.savefig(f'decodespeed_vs_compressionrate_{block_size}_{category}.png')

# エンコード速度 v.s. 圧縮率グラフ
for category in CATEGORIES:
texts = []
plt.cla()
# 他コーデック
for inx, cprefix in enumerate(OTHER_CODEC_LABEL_PREFIXES):
line = [[], []]
for label in other_codecs_df.keys():
if _is_avoid_label(label) is True:
continue
if label.startswith(cprefix):
encode_time = other_codecs_df.at[f'{category} mean encode time', label]
compress_rate = other_codecs_df.at[f'{category} mean compression rate', label]
texts.append(plt.text(encode_time, compress_rate, label[len(cprefix):], size=10))
line[0].append(encode_time)
line[1].append(compress_rate)
plt.plot(line[0], line[1], color=COLORLIST[inx], label=cprefix, marker='o')
# SRLA
for div_index, div in enumerate([0, 2]):
line = [[], []]
for label in srla_codecs_df.keys():
if label.startswith('SRLA'):
if not str(block_size) in label or not f'-V {div}' in label:
continue
option_prefix = label[len('SRLA'):label.index('V') - 1]
encode_time = srla_codecs_df.at[f'{category} mean encode time', label]
compress_rate = srla_codecs_df.at[f'{category} mean compression rate', label]
texts.append(plt.text(encode_time, compress_rate, option_prefix, size=10))
line[0].append(encode_time)
line[1].append(compress_rate)
plt.plot(line[0], line[1], color=COLORLIST[len(OTHER_CODEC_LABEL_PREFIXES) + div_index], label=f'SRLA V={div}', marker='^')

adjust_text(texts)
plt.title(f'Encoding speed v.s. compression rate for {category} blocksize:{block_size}')
plt.xlabel('Average encoding speed (\%)')
plt.ylabel('Average compression rate (\%)')
plt.legend(ncols=2)
plt.grid()
plt.tight_layout()
plt.savefig(f'encodespeed_vs_compressionrate_{block_size}_{category}.png')

0 comments on commit 3bd1629

Please sign in to comment.