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 <stdint.h>
10 
11 #include "lib/jxl/filters.h"
12 #include "lib/jxl/render_pipeline/render_pipeline.h"
13 
14 namespace jxl {
15 
16 // A RenderPipeline that is "obviously correct"; it may use potentially large
17 // amounts of memory and be slow. It is intended to be used mostly for testing
18 // purposes.
19 class SimpleRenderPipeline : public RenderPipeline {
20   std::vector<std::pair<ImageF*, Rect>> PrepareBuffers(
21       size_t group_id, size_t thread_id) override;
22 
23   void ProcessBuffers(size_t group_id, size_t thread_id) override;
24 
25   void RunPipeline();
26 
27   void PrepareForThreadsInternal(size_t num) override;
28 
29   // Full frame buffers. Both X and Y dimensions are padded by
30   // kRenderPipelineXOffset.
31   std::vector<ImageF> channel_data_;
32   size_t processed_passes_ = 0;
33 
34  private:
35   Rect MakeChannelRect(size_t group_id, size_t channel, bool is_color);
36 };
37 
38 }  // namespace jxl
39 
40 #endif  // LIB_JXL_RENDER_PIPELINE_SIMPLE_RENDER_PIPELINE_H_
41