Skip to content
Snippets Groups Projects
Commit 6f4ae6bc authored by Vojtech Moravec's avatar Vojtech Moravec
Browse files

Prepare QVC conversion.

parent 8ddcc645
No related branches found
No related tags found
No related merge requests found
......@@ -15,4 +15,6 @@ public interface IQvcFile {
IQvcHeader getHeader();
void report(StringBuilder builder);
void convertToNewerVersion(final boolean inPlace, final String inputPath, final String outputPath) throws IOException;
}
......@@ -40,7 +40,7 @@ public class SqQvcFile implements IQvcFile {
((QvcHeaderV2) header).setHuffmanDataSize(huffmanTreeBinaryRepresentationSize);
header.writeToStream(outputStream);
final int[] quantizationValues = codebook.getCentroids();
for (final int qV : quantizationValues) {
outputStream.writeShort(qV);
......@@ -90,6 +90,24 @@ public class SqQvcFile implements IQvcFile {
codebook = new SQCodebook(centroids, huffmanRoot);
}
private void convertQvcFromV1ToV2(final String outputFilePath) {
}
@Override
public void convertToNewerVersion(final boolean inPlace, final String inputPath, final String outputPath) {
final int headerVersion = header.getHeaderVersion();
if (!inPlace && (outputPath == null || outputPath.isEmpty())) {
System.err.println("InPlace conversion wasn't specified nor the output file path.");
return;
}
if (headerVersion == 1) {
convertQvcFromV1ToV2(inPlace ? inputPath : outputPath);
} else {
System.err.printf("Version %d is already the newest version of QVC file.\n", headerVersion);
}
}
@Override
public IQvcHeader getHeader() {
return header;
......
......@@ -98,6 +98,11 @@ public class VqQvcFile implements IQvcFile {
return codebook;
}
@Override
public void convertToNewerVersion(final boolean inPlace, final String inputPath, final String outputPath) {
assert false : "NOT IMPLEMENTED YET";
}
@Override
public void report(final StringBuilder builder) {
final int[][] vectors = codebook.getVectors();
......@@ -108,5 +113,7 @@ public class VqQvcFile implements IQvcFile {
}
builder.append("\n- - - - - - - - - - - - - - - - - - - - - - - - -\n");
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment