simple_render_pipeline.h (1456B)
1 // Copyright (c) the JPEG XL Project Authors. All rights reserved. 2 // 3 // Use of this source code is governed by a BSD-style 4 // license that can be found in the LICENSE file. 5 6 #ifndef LIB_JXL_RENDER_PIPELINE_SIMPLE_RENDER_PIPELINE_H_ 7 #define LIB_JXL_RENDER_PIPELINE_SIMPLE_RENDER_PIPELINE_H_ 8 9 #include <jxl/memory_manager.h> 10 11 #include <cstddef> 12 #include <utility> 13 #include <vector> 14 15 #include "lib/jxl/base/rect.h" 16 #include "lib/jxl/base/status.h" 17 #include "lib/jxl/image.h" 18 #include "lib/jxl/render_pipeline/render_pipeline.h" 19 20 namespace jxl { 21 22 // A RenderPipeline that is "obviously correct"; it may use potentially large 23 // amounts of memory and be slow. It is intended to be used mostly for testing 24 // purposes. 25 class SimpleRenderPipeline : public RenderPipeline { 26 std::vector<std::pair<ImageF*, Rect>> PrepareBuffers( 27 size_t group_id, size_t thread_id) override; 28 29 Status ProcessBuffers(size_t group_id, size_t thread_id) override; 30 31 Status PrepareForThreadsInternal(size_t num, bool use_group_ids) override; 32 33 // Full frame buffers. Both X and Y dimensions are padded by 34 // kRenderPipelineXOffset. 35 std::vector<ImageF> channel_data_; 36 size_t processed_passes_ = 0; 37 38 public: 39 explicit SimpleRenderPipeline(JxlMemoryManager* memory_manager) 40 : RenderPipeline(memory_manager) {} 41 42 private: 43 Rect MakeChannelRect(size_t group_id, size_t channel); 44 }; 45 46 } // namespace jxl 47 48 #endif // LIB_JXL_RENDER_PIPELINE_SIMPLE_RENDER_PIPELINE_H_