Remove unused AIX layout

This layout handled ADX segments+layers at the same time. While there is
some merit in that, it's more flexible and easier to maintain to mix
layer and segment layouts.

Performance and memory used is slightly worse though (impact should be
minimal)
This commit is contained in:
bnnm 2019-02-23 16:17:29 +01:00
parent 6bd23fe948
commit e5ddc9337a
8 changed files with 5 additions and 160 deletions

View File

@ -700,7 +700,6 @@ static const layout_info layout_info_list[] = {
{layout_segmented, "segmented"},
{layout_layered, "layered"},
{layout_aix, "AIX"},
{layout_blocked_mxch, "blocked (MxCh)"},
{layout_blocked_ast, "blocked (AST)"},

View File

@ -1,92 +0,0 @@
#include "layout.h"
#include "../vgmstream.h"
#include "../coding/coding.h"
void render_vgmstream_aix(sample_t * buffer, int32_t sample_count, VGMSTREAM * vgmstream) {
int samples_written=0;
aix_codec_data *data = vgmstream->codec_data;
while (samples_written<sample_count) {
int samples_to_do;
int samples_this_block = data->sample_counts[data->current_segment];
int current_stream;
int channels_sofar = 0;
if (vgmstream->loop_flag && vgmstream_do_loop(vgmstream)) {
data->current_segment = 1;
for (current_stream = 0; current_stream < data->stream_count; current_stream++)
{
int i;
reset_vgmstream(data->adxs[data->current_segment*data->stream_count+current_stream]);
/* carry over the history from the loop point */
for (i=0;i<data->adxs[data->stream_count+current_stream]->channels;i++)
{
data->adxs[1*data->stream_count+current_stream]->ch[i].adpcm_history1_32 =
data->adxs[0+current_stream]->ch[i].adpcm_history1_32;
data->adxs[1*data->stream_count+current_stream]->ch[i].adpcm_history2_32 =
data->adxs[0+current_stream]->ch[i].adpcm_history2_32;
}
}
vgmstream->samples_into_block = 0;
continue;
}
samples_to_do = vgmstream_samples_to_do(samples_this_block, 1, vgmstream);
/*printf("samples_to_do=%d,samples_this_block=%d,samples_written=%d,sample_count=%d\n",samples_to_do,samples_this_block,samples_written,sample_count);*/
if (samples_written+samples_to_do > sample_count)
samples_to_do=sample_count-samples_written;
if (samples_to_do == 0)
{
int i;
data->current_segment++;
/*printf("next %d, %d samples\n",data->current_file,data->files[data->current_file]->total_values/data->files[data->current_file]->info.channels);*/
for (current_stream = 0; current_stream < data->stream_count; current_stream++)
{
reset_vgmstream(data->adxs[data->current_segment*data->stream_count+current_stream]);
/* carry over the history from the previous segment */
for (i=0;i<data->adxs[data->current_segment*data->stream_count+current_stream]->channels;i++)
{
data->adxs[data->current_segment*data->stream_count+current_stream]->ch[i].adpcm_history1_32 =
data->adxs[(data->current_segment-1)*data->stream_count+current_stream]->ch[i].adpcm_history1_32;
data->adxs[data->current_segment*data->stream_count+current_stream]->ch[i].adpcm_history2_32 =
data->adxs[(data->current_segment-1)*data->stream_count+current_stream]->ch[i].adpcm_history2_32;
}
}
vgmstream->samples_into_block = 0;
continue;
}
/*printf("decode %d samples file %d\n",samples_to_do,data->current_file);*/
if (samples_to_do > AIX_BUFFER_SIZE/2)
{
samples_to_do = AIX_BUFFER_SIZE/2;
}
for (current_stream = 0; current_stream < data->stream_count; current_stream++)
{
int i,j;
VGMSTREAM *adx = data->adxs[data->current_segment*data->stream_count+current_stream];
render_vgmstream(data->buffer,samples_to_do,adx);
for (i = 0; i < samples_to_do; i++)
{
for (j = 0; j < adx->channels; j++)
{
buffer[(i+samples_written)*vgmstream->channels+channels_sofar+j] = data->buffer[i*adx->channels+j];
}
}
channels_sofar += adx->channels;
}
samples_written += samples_to_do;
vgmstream->current_sample += samples_to_do;
vgmstream->samples_into_block+=samples_to_do;
}
}

View File

@ -52,8 +52,6 @@ void render_vgmstream_interleave(sample_t * buffer, int32_t sample_count, VGMSTR
void render_vgmstream_flat(sample_t * buffer, int32_t sample_count, VGMSTREAM * vgmstream);
void render_vgmstream_aix(sample_t * buffer, int32_t sample_count, VGMSTREAM * vgmstream);
void render_vgmstream_segmented(sample_t * buffer, int32_t sample_count, VGMSTREAM * vgmstream);
segmented_layout_data* init_layout_segmented(int segment_count);
int setup_layout_segmented(segmented_layout_data* data);

View File

@ -1990,10 +1990,6 @@
RelativePath=".\layout\segmented.c"
>
</File>
<File
RelativePath=".\layout\aix_layout.c"
>
</File>
<File
RelativePath=".\layout\blocked_ast.c"
>

View File

@ -547,7 +547,6 @@
<ClCompile Include="coding\xa_decoder.c" />
<ClCompile Include="coding\xmd_decoder.c" />
<ClCompile Include="layout\segmented.c" />
<ClCompile Include="layout\aix_layout.c" />
<ClCompile Include="layout\blocked_ast.c" />
<ClCompile Include="layout\blocked_bdsp.c" />
<ClCompile Include="layout\blocked.c" />

View File

@ -1180,9 +1180,6 @@
<ClCompile Include="layout\segmented.c">
<Filter>layout\Source Files</Filter>
</ClCompile>
<ClCompile Include="layout\aix_layout.c">
<Filter>layout\Source Files</Filter>
</ClCompile>
<ClCompile Include="layout\blocked_ast.c">
<Filter>layout\Source Files</Filter>
</ClCompile>

View File

@ -602,7 +602,7 @@ void reset_vgmstream(VGMSTREAM * vgmstream) {
* Otherwise hit_loop will be 0 and it will be copied over anyway when we
* really hit the loop start. */
/* reset custom codec and layout data */
/* reset custom codec */
#ifdef VGM_USE_VORBIS
if (vgmstream->coding_type == coding_OGG_VORBIS) {
reset_ogg_vorbis(vgmstream);
@ -679,21 +679,10 @@ void reset_vgmstream(VGMSTREAM * vgmstream) {
if (vgmstream->coding_type == coding_NWA) {
nwa_codec_data *data = vgmstream->codec_data;
if (data)
reset_nwa(data->nwa);
}
if (vgmstream->layout_type == layout_aix) {
aix_codec_data *data = vgmstream->codec_data;
int i;
data->current_segment = 0;
for (i = 0; i < data->segment_count*data->stream_count; i++) {
reset_vgmstream(data->adxs[i]);
}
if (data) reset_nwa(data->nwa);
}
/* reset custom layouts */
if (vgmstream->layout_type == layout_segmented) {
reset_layout_segmented(vgmstream->layout_data);
}
@ -703,7 +692,7 @@ void reset_vgmstream(VGMSTREAM * vgmstream) {
}
/* note that this does not reset the constituent STREAMFILES
* (ch's streamfiles init in metas, nor their internal state) */
* (vgmstream->ch[N].streamfiles' internal state, though shouldn't matter) */
}
/* Allocate memory and setup a VGMSTREAM */
@ -875,28 +864,6 @@ void close_vgmstream(VGMSTREAM * vgmstream) {
/* free custom layouts */
if (vgmstream->layout_type == layout_aix) {
aix_codec_data *data = (aix_codec_data *) vgmstream->codec_data;
if (data) {
if (data->adxs) {
int i;
for (i = 0; i < data->segment_count*data->stream_count; i++) {
/* note that the close_streamfile won't do anything but deallocate itself,
* there is only one open file in vgmstream->ch[0].streamfile */
close_vgmstream(data->adxs[i]);
}
free(data->adxs);
}
if (data->sample_counts) {
free(data->sample_counts);
}
free(data);
}
vgmstream->codec_data = NULL;
}
if (vgmstream->layout_type == layout_segmented) {
free_layout_segmented(vgmstream->layout_data);
vgmstream->layout_data = NULL;
@ -1063,9 +1030,6 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
case layout_blocked_vs_square:
render_vgmstream_blocked(buffer,sample_count,vgmstream);
break;
case layout_aix:
render_vgmstream_aix(buffer,sample_count,vgmstream);
break;
case layout_segmented:
render_vgmstream_segmented(buffer,sample_count,vgmstream);
break;
@ -2781,8 +2745,7 @@ int vgmstream_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t s
/* stream/offsets not needed, managed by layout */
if (vgmstream->layout_type == layout_aix ||
vgmstream->layout_type == layout_segmented ||
if (vgmstream->layout_type == layout_segmented ||
vgmstream->layout_type == layout_layered)
return 1;

View File

@ -265,7 +265,6 @@ typedef enum {
layout_blocked_vs_square,
/* otherwise odd */
layout_aix, /* CRI AIX's wheels within wheels */
layout_segmented, /* song divided in segments (song sections) */
layout_layered, /* song divided in layers (song channels) */
@ -1109,20 +1108,6 @@ typedef struct {
void *io_config;
} acm_codec_data;
#define AIX_BUFFER_SIZE 0x1000
/* AIXery */
typedef struct {
sample_t buffer[AIX_BUFFER_SIZE];
int segment_count;
int stream_count;
int current_segment;
/* one per segment */
int32_t *sample_counts;
/* organized like:
* segment1_stream1, segment1_stream2, segment2_stream1, segment2_stream2*/
VGMSTREAM **adxs;
} aix_codec_data;
/* for files made of "continuous" segments, one per section of a song (using a complete sub-VGMSTREAM) */
typedef struct {
int segment_count;