| 126 | } |
| 127 | |
| 128 | bool 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 | } |
nothing calls this directly
no test coverage detected