Skip to content

Instantly share code, notes, and snippets.

@hcs64
Last active August 9, 2022 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hcs64/ac8fdb811bf55ab4463ac9aeb4ddface to your computer and use it in GitHub Desktop.
Save hcs64/ac8fdb811bf55ab4463ac9aeb4ddface to your computer and use it in GitHub Desktop.
Find and check matching codebooks
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "vorbis_custom_data_wwise.h"
int main(void) {
#if 1
for (int ai = 0; ai < 0x256; ++ai) {
const wvc_info * ao = &wvc_list_aotuv603[ai];
int si;
for (si = 0; si < 0x256; ++si) {
const wvc_info * std = &wvc_list_standard[si];
if (std->size != ao->size) {
continue;
}
if (memcmp(std->codebook, ao->codebook, ao->size) == 0) {
printf(" {0x%04x,0x%04x,wvc_standard_%04x},\n", ao->id, ao->size, si);
break;
}
}
if (si == 0x256) {
printf(" {0x%04x,0x%04x,wvc_aotuv603_2_%04x},\n", ao->id, ao->size, ai);
}
}
#endif
#if 0
if (sizeof(wvc_list_aotuv603) != sizeof(wvc_list_aotuv603_2)) {
printf("array size mismatch");
}
printf("%lu\n", sizeof(wvc_list_aotuv603));
for (int i = 0; i < sizeof(wvc_list_aotuv603)/sizeof(wvc_list_aotuv603[0]); ++i) {
const wvc_info * one = &wvc_list_aotuv603[i];
const wvc_info * two = &wvc_list_aotuv603_2[i];
if (one->id != two->id || one->size != two->size || (memcmp(one->codebook, two->codebook, one->size) != 0)) {
printf("mismatch %04x\n", i);
}
}
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment