This commit is contained in:
minjaesong
2025-09-13 22:02:56 +09:00
parent 722e8e893f
commit 712506c91c
4 changed files with 648 additions and 13 deletions

View File

@@ -6,16 +6,19 @@ CFLAGS = -std=c99 -Wall -Wextra -O2 -D_GNU_SOURCE
LIBS = -lm -lzstd
# Source files and targets
SOURCES = encoder_tev.c
TARGETS = encoder_tev
TARGETS = encoder_tev encoder_tav
# Build all encoders
all: $(TARGETS)
# Build main encoder
encoder_tev: encoder_tev.c
tev: encoder_tev.c
rm -f encoder_tev
$(CC) $(CFLAGS) -o $@ $< $(LIBS)
$(CC) $(CFLAGS) -o encoder_tev $< $(LIBS)
tav: encoder_tav.c
rm -f encoder_tav
$(CC) $(CFLAGS) -o encoder_tav $< $(LIBS)
# Default target
$(TARGETS): all
@@ -45,8 +48,8 @@ help:
@echo ""
@echo "Targets:"
@echo " all - Build both encoders (default)"
@echo " encoder_tev - Build the main TEV encoder"
@echo " encoder_tev_xyb - Build the XYB color space encoder"
@echo " tev - Build the main TEV encoder"
@echo " tav - Build the advanced TAV encoder"
@echo " debug - Build with debug symbols"
@echo " clean - Remove build artifacts"
@echo " install - Install to /usr/local/bin"
@@ -54,8 +57,9 @@ help:
@echo " help - Show this help"
@echo ""
@echo "Usage:"
@echo " make # Build both encoders"
@echo " ./encoder_tev input.mp4 -o output.tev"
@echo " ./encoder_tev_xyb input.mp4 -o output.tev"
@echo " make # Build both encoders"
@echo " make tev # Build TEV encoder"
@echo " make tav # Build TAV encoder"
@echo " sudo make install # Install both encoders"
.PHONY: all clean install check-deps help debug

View File

@@ -1193,6 +1193,11 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "Error: Failed to compress frame %d\n", frame_count);
break;
}
else {
// Write a sync packet only after a video is been coded
uint8_t sync_packet = TAV_PACKET_SYNC;
fwrite(&sync_packet, 1, 1, enc->output_fp);
}
// Copy current frame to previous frame buffer
size_t float_frame_size = enc->width * enc->height * sizeof(float);
@@ -1213,7 +1218,11 @@ int main(int argc, char *argv[]) {
// Update actual frame count in encoder struct
enc->total_frames = frame_count;
// Write final sync packet
uint8_t sync_packet = TAV_PACKET_SYNC;
fwrite(&sync_packet, 1, 1, enc->output_fp);
// Update header with actual frame count (seek back to header position)
if (enc->output_fp != stdout) {
long current_pos = ftell(enc->output_fp);