MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / encode

Method encode

modules/engine/image_coder/src/image_coder_jpeg.cpp:128–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128bool JPEGImageEncoder::encode() SKR_NOEXCEPT
129{
130 SKR_ASSERT(initialized);
131 const int32_t Quality = 5;
132
133 const auto color_format = get_color_format();
134 const int PixelFormat = ConvertTJpegPixelFormat(color_format);
135 const int Subsampling = TJSAMP_420;
136 const int Flags = TJFLAG_NOREALLOC | TJFLAG_FASTDCT;
137
138 unsigned long OutBufferSize = tjBufSize(get_width(), get_height(), Subsampling);
139 encoded_data = JPEGImageEncoder::Allocate(OutBufferSize, get_alignment());
140 encoded_size = OutBufferSize;
141
142 const bool bSuccess = tjCompress2(Compressor, decoded_view.data(),
143 get_width(), bytes_per_row, get_height(), PixelFormat, &encoded_data,
144 &OutBufferSize, Subsampling, Quality, Flags) == 0;
145
146 return bSuccess;
147}
148}

Callers

nothing calls this directly

Calls 7

get_color_formatFunction · 0.85
ConvertTJpegPixelFormatFunction · 0.85
get_widthFunction · 0.85
get_heightFunction · 0.85
get_alignmentFunction · 0.85
AllocateFunction · 0.50
dataMethod · 0.45

Tested by

no test coverage detected