From bd99035701c28d6f01f694ccf54619e26fc70d78 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 23 Dec 2020 17:30:52 +0100 Subject: [PATCH] Fix an offset calculation error. --- CMakeLists.txt | 5 +++++ main.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6202553..7283d1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,3 +12,8 @@ link_directories(/opt/vc/lib) add_executable(fbcp main.c) target_link_libraries(fbcp bcm_host) + + +set (CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}") + +set (CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}") \ No newline at end of file diff --git a/main.c b/main.c index bbe839d..3fa5527 100644 --- a/main.c +++ b/main.c @@ -154,10 +154,12 @@ int process_interlaced() { uint16_t *src = &screenbuf[bufNum][firstRow * vinfo.xres + firstCol]; uint16_t *dst = (uint16_t *)&fbp[(firstRow * vinfo.xres + firstCol) * 2]; + uint32_t moffset = vinfo.xres * INTERLACE_NUM; + for(int row = firstRow; row <= lastRow; row += INTERLACE_NUM) { memcpy(dst, src, bytes); - src += vinfo.xres; - dst += vinfo.xres; + src += moffset; + dst += moffset; } // memcpy(fbp, screenbuf[2], vinfo.xres * vinfo.yres * 2);