all repos — mgba @ 11c00d89589d2ecdd8c39ca684f3ee3a2fcfcf90

mGBA Game Boy Advance Emulator

Use FFV1 for reduced filesize
Jeffrey Pfau jeffrey@endrift.com
Sat, 09 Aug 2014 04:17:34 -0700
commit

11c00d89589d2ecdd8c39ca684f3ee3a2fcfcf90

parent

88695a5ab10510abd143191d8ed69465990d0ecd

1 files changed, 5 insertions(+), 5 deletions(-)

jump to
M src/platform/ffmpeg/ffmpeg-encoder.csrc/platform/ffmpeg/ffmpeg-encoder.c

@@ -10,7 +10,7 @@

bool FFmpegEncoderCreate(struct FFmpegEncoder* encoder) { av_register_all(); AVCodec* acodec = avcodec_find_encoder(AV_CODEC_ID_FLAC); - AVCodec* vcodec = avcodec_find_encoder(AV_CODEC_ID_HUFFYUV); + AVCodec* vcodec = avcodec_find_encoder(AV_CODEC_ID_FFV1); if (!acodec || !vcodec) { return false; }

@@ -46,7 +46,7 @@ encoder->video->bit_rate = 4000000;

encoder->video->width = VIDEO_HORIZONTAL_PIXELS; encoder->video->height = VIDEO_VERTICAL_PIXELS; encoder->video->time_base = (AVRational) { VIDEO_TOTAL_LENGTH, GBA_ARM7TDMI_FREQUENCY }; - encoder->video->pix_fmt = AV_PIX_FMT_RGB24; + encoder->video->pix_fmt = AV_PIX_FMT_BGR0; encoder->video->gop_size = 15; encoder->video->max_b_frames = 0; avcodec_open2(encoder->video, vcodec, 0);

@@ -115,9 +115,9 @@ unsigned x, y;

for (y = 0; y < VIDEO_VERTICAL_PIXELS; ++y) { for (x = 0; x < VIDEO_HORIZONTAL_PIXELS; ++x) { uint32_t pixel = pixels[stride * y + x]; - encoder->videoFrame->data[0][y * encoder->videoFrame->linesize[0] + x * 3] = pixel; - encoder->videoFrame->data[0][y * encoder->videoFrame->linesize[0] + x * 3 + 1] = pixel >> 8; - encoder->videoFrame->data[0][y * encoder->videoFrame->linesize[0] + x * 3 + 2] = pixel >> 16; + encoder->videoFrame->data[0][y * encoder->videoFrame->linesize[0] + x * 4] = pixel >> 16; + encoder->videoFrame->data[0][y * encoder->videoFrame->linesize[0] + x * 4 + 1] = pixel >> 8; + encoder->videoFrame->data[0][y * encoder->videoFrame->linesize[0] + x * 4 + 2] = pixel; } }