Coder Social home page Coder Social logo

vtm_ctu_partition's Introduction

VTM_CTU_partition

Save and Dispaly VTM CTU partition info.

Johnny_1280x720_60_0.yuv, Johnny_1280x720_60_VTM.h266 and CTU/CTU_x.txt is only used for test.

This Project Usage:

First, install numpy, PIL, matplotlib for your Python3.

And then:
git clone https://github.com/codec2021/VTM_CTU_partition.git

python3 Draw_CTU_Partition.py

You will get the result picture:
image

Following the steps below, you can also obtain your own block partitioning results.

Step1. Change VTM22.0 Encoder Code

VTM Code is here: https://vcgit.hhi.fraunhofer.de/jvet/VVCSoftware_VTM.git

At the end of function void EncCu::compressCtu in EncCu.cpp file, Please add the following code:

std::string ctuNum = std::to_string(ctuRsAddr);
std::ofstream ctuPartitionFile;

std::cout << ctuNum << std::endl;
ctuPartitionFile.open("./CTU_" + ctuNum + ".txt");

for (auto &currCU : cs.traverseCUs(CS::getArea(cs, area, ChannelType::LUMA), ChannelType::LUMA))
{
	const CompArea&  lumaArea = currCU.block(COMPONENT_Y);
	int cuX = lumaArea.x;
	int cuY = lumaArea.y;
	int cuH = lumaArea.height;
	int cuW = lumaArea.width;
	std::string cuInfo = "";

	cuInfo = std::to_string(cuX) + " " + std::to_string(cuY) + " " + std::to_string(cuH) + " " + std::to_string(cuW) +"\n";
	ctuPartitionFile << cuInfo;
}
ctuPartitionFile.close();

Then build VTM22.0 Project to get the EncoderApp binary

Step2. run VTM Encoder

Prepare your test yuv and cfg file, then run

for example:

./EncoderApp -c ./encoder_randomaccess_vtm.cfg -i Johnny_1280x720_60.yuv -wdt 1280 -hgt 720 -fr 30 -f 1 -q 30 -b Johnny_1280x720_60_VTM.h266

you will get some file named as CTU_0.txt, CTU_1.txt ... file in your local dir.

Step3. move all CTU_x.txt file to local ./CTU Dir

mkdir CTU
mv *.txt ./CTU
image

Step4. run the Draw_CTU_Partition.py by python3

set the encoded yuv name, width, height, ctu_size in the Draw_CTU_Partition.py: image

and then run:

python3 Draw_CTU_Partition.py

vtm_ctu_partition's People

Contributors

codec2021 avatar

Stargazers

 avatar 何亮 avatar  avatar

Watchers

 avatar

Forkers

zhoutingkai

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.