This commit is contained in:
Brooke Vibber 2023-03-25 20:26:45 -07:00
parent 7fa606743f
commit 5196adef43
7 changed files with 6 additions and 18 deletions

View file

@ -589,7 +589,6 @@ function decimate(input, palette, n) {
// preface the reserved bits
let buckets = reserved.slice().map((c) => [atariRGB[c]]).concat([input.slice()]);
if (input.length != 160) {
console.log(input.length);
throw new Error('xxx bad input size');
}
@ -615,7 +614,6 @@ function decimate(input, palette, n) {
};
let medianCut = (bucket, range) => {
if (bucket.length < 2) {
console.log(bucket);
throw new Error('short bucket');
}
//console.log('medianCut', bucket, range);
@ -642,7 +640,6 @@ function decimate(input, palette, n) {
// Find the bucket with the greatest range in any channel
let ranges = buckets.map((bucket) => {
if (bucket.length == 0) {
console.log(buckets);
throw new Error('xxx empty bucket');
}
let red = bucket.map((rgb) => rgb.r);
@ -766,13 +763,7 @@ function decimate(input, palette, n) {
let index = dists.indexOf(closest);
return palette[index];
});
// hack
decimated.sort((a, b) => a - b);
console.log(decimated);
// we shouldn't have to do this
//decimated[0] = 0;
console.log(decimated);
// Palette fits
return dither(decimated);
@ -842,7 +833,6 @@ async function convert(source) {
height,
rgba
} = await loadImage(source);
console.log({width,height});
if (width > 160) {
throw new Error(`expected <160px width, got ${width} pixels`);
@ -893,9 +883,7 @@ async function convert(source) {
.slice(y * width, (y + 1) * width);
if (padding) {
console.log(`length was ${inputLine.length}`);
inputLine = left.concat(inputLine, right);
console.log(`length is now ${inputLine.length}`);
}
if (y > 0) {
let error = lines[y - 1].error;

View file

@ -4,7 +4,7 @@ ffmpeg \
-i 'cats-audio.wav' \
-ac 2 \
-ar 48000 \
-vf 'pad=w=640:h=360:x=52:y=20' \
-vf 'pad=w=534' \
-pix_fmt yuv420p \
-movflags +faststart \
-y cats-dither.mp4

View file

@ -4,7 +4,7 @@ mkdir -p frames
ffmpeg \
-i 'cats computer fun.mp4' \
-vf 'scale=160:150,pad=h=160:y=5' \
-vf 'scale=320:150,pad=h=192:y=5' \
-an \
-y 'frames/cats-%04d.png'

View file

@ -4,7 +4,7 @@ ffmpeg \
-i 'doom-audio.wav' \
-ac 2 \
-ar 48000 \
-vf 'pad=w=640:h=360:x=52:y=20' \
-vf 'pad=w=534' \
-pix_fmt yuv420p \
-movflags +faststart \
-y doom-dither.mp4

View file

@ -8,7 +8,7 @@ ffmpeg \
-i 'doom-speedrun.webm' \
-t $TIME \
-r 60000/1001 \
-vf 'scale=160:192' \
-vf 'scale=320:192' \
-an \
-y 'frames/doom-%04d.png'

View file

@ -4,7 +4,7 @@ ffmpeg \
-i 'colamath-audio.wav' \
-ac 2 \
-ar 48000 \
-vf 'pad=w=640:h=360:x=52:y=20' \
-vf 'pad=w=534' \
-pix_fmt yuv420p \
-movflags +faststart \
-y colamath-dither.mp4

View file

@ -4,7 +4,7 @@ mkdir -p frames
ffmpeg \
-i colamath-dv.avi \
-vf 'yadif=1,scale=160:200,crop=h=160' \
-vf 'yadif=1,scale=320:200,crop=h=192:y=4' \
-an \
-y 'frames/colamath-%04d.png'