uvgVPCCenc 1.0.0
uvgVPCCenc is an open-source real-time V-PCC encoder library written in C++ from scratch.
Loading...
Searching...
No Matches
mapGeneration.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 * This file is part of uvgVPCCenc V-PCC encoder.
3 *
4 * Copyright (c) 2024, Tampere University, ITU/ISO/IEC, project contributors
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without modification,
8 * are permitted provided that the following conditions are met:
9 *
10 * * Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 * * Redistributions in binary form must reproduce the above copyright notice, this
14 * list of conditions and the following disclaimer in the documentation and/or
15 * other materials provided with the distribution.
16 *
17 * * Neither the name of the Tampere University or ITU/ISO/IEC nor the names of its
18 * contributors may be used to endorse or promote products derived from
19 * this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON
28 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 * INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
31 ****************************************************************************/
32
34
35#include "uvgvpcc/uvgvpcc.hpp"
36
37using namespace uvgvpcc_enc;
38
39
40struct Filter {
41 std::vector<float> data_;
42 double shift_;
43};
48
50 public:
51 static void initializeStaticParameters();
52 static void initGOFMapGeneration(std::shared_ptr<uvgvpcc_enc::GOF>& gof);
53 static void generateFrameMaps(std::shared_ptr<uvgvpcc_enc::Frame>& frame);
54 static void writeFrameMapsYUV(std::shared_ptr<uvgvpcc_enc::Frame>& frame);
55
56 private:
57
58 static Filter444to420 g_filter444to420_unique_;
59
60 static void mapsGeneration(uvgvpcc_enc::Frame& frame, const size_t& gofMapsHeight);
61 static void writePatch(const uvgvpcc_enc::Patch& patch, const size_t& imageSize, uvgvpcc_enc::Frame& frame);
62 static void writePatchAxisSwap(const uvgvpcc_enc::Patch& patch, const size_t& imageSize, uvgvpcc_enc::Frame& frame);
63
64 static void fillBackgroundImages(uvgvpcc_enc::Frame& frame, const size_t& gofMapsHeight);
65
66 static void fillBackgroundEmptyBlock(uvgvpcc_enc::Frame& frame, const size_t blockSize, const size_t imageSize,
67 const size_t uBlk, const size_t vBlk, const size_t uom, const size_t vom);
68 static void fillBackgroundNonEmptyBlock(uvgvpcc_enc::Frame& frame, const size_t blockSize, const size_t imageSize,
69 const size_t uom, const size_t vom, const size_t pixelBlockCount,
70 size_t missingPixelCount, std::vector<size_t>& iterations);
71 static void updateSums(uvgvpcc_enc::Frame& frame, const size_t blockLeft, const size_t blockTop, const size_t iBlk,
72 const size_t jBlk, const size_t imageSize, std::vector<size_t>& iterations,
73 const size_t blockSize, std::vector<size_t>& sumGeo, std::vector<size_t>& sumR,
74 std::vector<size_t>& sumG, std::vector<size_t>& sumB, std::vector<size_t>& count);
75 static void allocateMaps(uvgvpcc_enc::Frame& frame, const size_t& gofMapsHeight);
76 static void RGB444toYUV420(std::vector<uint8_t>& img, const size_t& width, const size_t& height);
77
78 static void downsampling(const std::vector<float>& chroma_in, std::vector<float>& chroma_out, const size_t widthIn,
79 const size_t heightIn);
80};
Definition mapGeneration.hpp:49
static void generateFrameMaps(std::shared_ptr< uvgvpcc_enc::Frame > &frame)
Definition mapGeneration.cpp:442
static void writeFrameMapsYUV(std::shared_ptr< uvgvpcc_enc::Frame > &frame)
Definition mapGeneration.cpp:461
static void initGOFMapGeneration(std::shared_ptr< uvgvpcc_enc::GOF > &gof)
Definition mapGeneration.cpp:519
static void initializeStaticParameters()
Definition mapGeneration.cpp:56
Definition log.hpp:43
Definition mapGeneration.hpp:44
Filter horizontal_
Definition mapGeneration.hpp:45
Filter vertical_
Definition mapGeneration.hpp:46
Definition mapGeneration.hpp:40
double shift_
Definition mapGeneration.hpp:42
std::vector< float > data_
Definition mapGeneration.hpp:41
Definition uvgvpcc.hpp:167
Definition uvgvpcc.hpp:54