~hedgepigdaniel/dewobble

40db06c76f973ebf90f560d0bc160ce5d294786f — Daniel Playfair Cal 2 years ago 8efe5ef
fix: allocate output buffers of output camera size, not input camera
2 files changed, 11 insertions(+), 4 deletions(-)

M include/filter_base.hpp
M src/filter/filter_base.cpp
M include/filter_base.hpp => include/filter_base.hpp +1 -0
@@ 22,6 22,7 @@ class FilterBase
    std::queue<cl_mem> m_preallocated_output_buffers;
    cl_mem get_frame_buffer(
        std::queue<cl_mem> &preallocated_buffers,
        Camera camera,
        cl_mem_flags flags);
    void free_preallocated_buffers(std::queue<cl_mem> &preallocated_buffers);
    void release_frame_buffer(

M src/filter/filter_base.cpp => src/filter/filter_base.cpp +10 -4
@@ 27,6 27,7 @@ void FilterBase::free_preallocated_buffers(

cl_mem FilterBase::get_frame_buffer(
    std::queue<cl_mem> &preallocated_buffers,
    Camera camera,
    cl_mem_flags flags)
{
    cl_mem buffer;


@@ 39,8 40,7 @@ cl_mem FilterBase::get_frame_buffer(
    buffer = clCreateBuffer(
        m_config.get_opencl_context(),
        flags,
        m_config.get_input_camera().m_width *
            m_config.get_input_camera().m_height * 3 / 2,
        camera.m_width * camera.m_height * 3 / 2,
        NULL,
        &err);



@@ 52,12 52,18 @@ cl_mem FilterBase::get_frame_buffer(

cl_mem FilterBase::get_output_frame_buffer()
{
    return get_frame_buffer(m_preallocated_output_buffers, CL_MEM_WRITE_ONLY);
    return get_frame_buffer(
        m_preallocated_output_buffers,
        m_config.get_output_camera(),
        CL_MEM_WRITE_ONLY);
}

cl_mem FilterBase::get_input_frame_buffer()
{
    return get_frame_buffer(m_preallocated_input_buffers, CL_MEM_READ_ONLY);
    return get_frame_buffer(
        m_preallocated_input_buffers,
        m_config.get_input_camera(),
        CL_MEM_READ_ONLY);
}

void FilterBase::release_frame_buffer(