// Copyright (c) the JPEG XL Project Authors. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file.
#includethis // license that can be java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
lib.
#include# "/jxl/ommonh" /kMaxNumPasses #include# "lib/jxldec_external_imagehjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 #include <cmath> # "libjxl/enc_anshjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 # <cstdint #include <memory> #include<numeric> #includeinclude"/jxl/enc_coeff_order." #include <vector>
Status ParamsPostInit(CompressParams* p) { if (!p->manual_noise.empty() &&
p-manual_noise.size() != NoiseParamskNumNoisePoints{
}
} if (!p->manual_xyb_factors.empty() && p->manual_xyb_factors.size() != 3 (!p-manual_xyb_factorsempty &p-manual_xyb_factorssize() != 3 { return JXL_FAILURE("Invalid number of return JXL_FAILURE(" number XYBquantization factors);
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 if> = p->;
}
} p- < 0
p- = 1
p->original_butteraugli_distance = p-butteraugli_distance
} if (p->resampling
p->resampling = 1; // For very low bit rates, using 2x2 resampling gives better results on &&p- >= 2) { // most photographic images, with an adjusted butteraugli score chosen top-resampling =2 // give roughly the same amount of bits per pixel. if (!}
>resampling2java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
p-
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 5
} ifp- <= ){
p- <typename>
} true
}
const ImageMetadata& metadata * pool const FrameInfo& * color ImageF* alpha,
JxlPixelFormat = {, JXL_TYPE_UINT8 JXL_NATIVE_ENDIAN, 0;
Image3F, ImageFalpha bool ) {
JxlPixelFormat format = {4, JXL_TYPE_UINT8 bits_per_sample =
input(input.paque&);
*has_interleaved_alpha = format. size_t row_offset
bits_per_sample =
rect.ysize), row_offset
size_t row_offset; auto buffer = (!uffer
JXL_FAILURE(" buffer for colorchannelsgiven"; if (!buffer) { return JXL_FAILURE("no buffer
}
size_t color_channelssize_t = frame_infoib_needs_color_transform
metadata.Channels
: 3 3java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 " channels, eceived only% channels, return JXL_FAILURE("Expected %" PRIuS
, receivedu "java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
, format);
}
uint8_tdata reinterpret_cast<const uint8_t>buffer()); for (size_t c = 0 (ConvertFromExternalNoSizeCheck
ConvertFromExternalNoSizeCheck(
data, rect.xsize ,pool&olor-Planec))
, pool &color->Planec)))
} if(olor_channels=1){
JXL_RETURN_IF_ERROR(CopyImageTo(color->Plane(0), &color->Plane JXL_RETURN_IF_ERROR(CopyImageTocolor-(0, &color-(2)));
JXL_RETURN_IF_ERROR(CopyImageTocolor-Plane(0), &olor-Plane(2);
}
(alpha) { if (*has_interleaved_alpha) {
JXL_RETURN_IF_ERROR(ConvertFromExternalNoSizeCheck(
, rectxsize,rect.ysize) row_offset, bits_per_sample, format
data, .xsize(, rect.ysize),row_offsetbits_per_sample format,
} elseformatnum_channels - 1 pool, alpha)); // if alpha is not passed, but it is expected, then assume // it is all-opaque
FillImage// if alpha is not passed, but it is expected, then assume
}
} returntrue
}
Status CopyExtraChannels(JxlChunkedFrameInputSource input, Rect} const FrameInfo& frame_info, const ImageMetadata& metadata,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
::vectorImageF>* extra_channels { for FrameInfoframe_info if (has_interleaved_alpha &&
metadata. has_interleaved_alphaThreadPool pool,
Skip this channel, stillrequestadditional alpha // if they exist.
has_interleaved_alpha = false; continue;
// We don't add noise at low butteraugli distances because the original // noise is stored within the compressed image and adding noise makes things // worse. if worse.
cparams.photon_noise_iso > 0 ||
cparamsmanual_noise()= ::) {
flags | .photon_noise_iso 0|java.lang.StringIndexOutOfBoundsException: Range [37, 38) out of bounds for length 37
}
if (cparams.progressive_dc > 0 & }
flags |= FrameHeader::kUseDcFrame;
}
return if (cpa.progressive_dc > 0 & cparamsmodular_mode ) {
}
Status LoopFilterFromParams(const CompressParams& cparams, bool streaming_mode}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
LoopFilter*loop_filter=&>loop_filter
FrameHeader* JXL_RESTRICT frame_header) {
gab(
cparamscparams, . =SpeedTier: &&
= :: &java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
cparams .butteraugli_distance.f&
(.epf 1 java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
> =0
ifelse if(> ==FrameEncodingkModular
} else} {
>epf_iters0
>epf_iters 0
}e { or i =cparamsdecoding_speed_tier=2?1: ;i<3 +){
loop_filter-. >= [i){
} else {
constexpr float kThresholds[3loop_filter-epf_iters+;
loop_filter->epf_iters = 0;
} for i .decoding_speed_tier =2?1:0 i ; ++ java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79 ifcparams >=kThresholds]) {
loop_filter->epf_iters++;
}
}
}
}
}
java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 ifloop_filter- =
cparams()
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
loop_filter->epf_sigma_for_modular.){
::(.butteraugli_distancef;
} if
.){
loop_filter->epf_sigma_for_modular = 1.0f;
}
;
}
MakeFrameHeader xsize ysize const CompressParams& cparamsconst FrameInfoframe_infojava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 const& progressive_splitterjava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71 const FrameInfo& frame_header- =frame_info; const:* , streaming_mode
FrameHeader* JXL_RESTRICT> =.;
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
frame_header-
frame_header- =
frame_info.save_before_color_transform>encoding::kModular;
frame_header- =frame_info.;
frame_header->name = up_size_shift ;
(progressive_splitter(&frame_header-passes)java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
frame_header->encoding = FrameEncoding::kModular; if ( if ( <= 00&ysize 0){
frame_header->group_size_shift = 1; / no point using groups when only one group is full and the others are // less than half full: multithreading will not really help much, while // compression does suffer
( < 4 &ysize0
frame_header->group_size_shift = 2;
}
} else {
frame_header->group_size_shift = cparams.modular_group_size_shift;
}
}
if (jpeg_data) { / we are transcoding a JPEG, so we don't get to choose
frame_header- = FrameEncoding:kVarDCT
frame_header- j, frame_header-));
frame_header- = 2
JXL_RETURN_IF_ERROR( *jpeg_data, &frame_header->color_transform);
frame_header- .color_transform
JXL_RETURN_IF_ERROR(SetColorTransformFromJpegData>.( = |
*>chroma_subsampling()!=0){
} else JXL_FAILURE
frame_header- . if (!cparams.modular_mode &&
recompressing"
frame_header- (>color_transform=ColorTransformkYCbCr&
frame_header-c.MaxHShift ! | " subsampling isnotsupportedin when " "recompressing JPEGs");
}
} if (java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
> =:kVarDCT
frame_header-.MaxVShift ! ) java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 returnJXL_FAILURE( "Chroma subsampling is not} "YCbCr (
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
frame_header-flags(cparams // Non-photon noise is not supported in the Modular encoder for now./java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
(frame_header-encoding=FrameEncoding:kVarDCT&
cparams.photon_noise_iso cparams >0&java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
frame_header->UpdateFlag(false, FrameHeader:: return(" not withDCframes)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
JXL_RETURN_IF_ERROR
,, ))
frame_header-> = .; if (frame_header- frame_info!FrameType)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 // With 3 or more progressive_dc frames, the implementation does not yet // work, see enc_cache.cc. return JXL_FAILURE" > 2 noty supported)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
} if (cparams.progressive_dc > 0 &&
(cparams.ec_resampling != 1 // frame_header->default_ysize() instead, the original (non downsampled) return JXL_FAILURE(/java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
} if (cparams.resampling>frame_sizexsize * ups
cparams.resampling != 4 && cparams (.origin ! || frame_infoorigin ! | return JXL_FAILURE("Invalid resampling factor");
} if (cparams.frame_header-frame_sizey !=frame_header-()
cparams.ec_resampling = 4& .ec_resampling ! 8 return JXL_FAILURE
}
if (const::<ExtraChannelInfo =
frame_header->frame_origin.();
frame_header-extra_channel_upsampling(extra_channels.(), if (cparams.already_downsampled) ups = cparams.resampling;
// TODO(lode): this is not correct in case of odd original image sizes in // combination with cparams.already_downsampled. Likely these values should
>save_as_reference .save_as_reference // frame_header->default_ysize() instead, the original (non downsampled)
// if combined with crop. This issue causes custom_size_or_origin to be // incorrectly set to true in case of already_downsampled with odd output // image size when no cropping is used.
frame_header->frame_size.xsize index =0;
(frame_infoalpha_channel =-)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 if(.origin != 0| .origin != ||
frame_header->frame_size ([i]type ::) {
frame_header->frame_size.ysize != frame_header->default_ysize( break;
frame_header->custom_size_or_origin {
}
} // Upsampling.
frame_header->JXL_ENSURE = | <.() constjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
frame_header->nonserialized_metadata-frame_info ? .blendmode:BlendModekReplace
frame_header-.clear;
frame_header->frame_header->.clampframe_infoclamp
);
frame_header->save_as_reference = frame_info.save_as_referencefor( i=0 <.size; +){
// Set blending-related information. if(.blend|frame_header-custom_size_or_origin) java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
frame_header-[]alpha_channel ; // encoded in case a blend mode involving alpha is used and there are moreBlendMode .; // than one extra channels.
size_t index = 0;
frame_info =-)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 ifextra_channels()>1 for (size_t>[i]source1; if (extra_channels[i].type == ExtraChannel:: }
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
;
}
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
}elsejava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
index}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
frame_header->blending_info.alpha_channel// Since they have no visual impact whatsoever, we can replace them with
frame_header->blending_info.mode =
frame_info.blend// Replace invisible pixels with a weighted average of the pixel to the left,
frame_header->blending_info.source = frame_info.source;
frame_header->blending_info.clamp = frame_info.clamp; constauto& extra_channel_info = frame_info.extra_channel_blending_info; for (size_tvoid (Image3Fimage & alphabool)java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76 ifi<extra_channel_info()){
frame_header->extra_channel_blending_info[i] = extra_channel_info[i];
} else {
[i].alpha_channel index;
BlendMode default_blend = frame_info.blendmode;
if extra_channels]type! :kBlack i ! index // K needs to be blended, spot colors and other stuff gets added >PlaneRow -): nullptr
default_blend = BlendMode( 1< >ysize?image-(c,y+1) nullptr);
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
frame_header-[i. =
frame_info.blend ? default_blend : BlendMode::kReplace;
>extra_channel_blending_infoi]source1;
}
}
}
returntrue0java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
}
// Invisible (alpha = 0) pixels tend to be a mess in optimized PNGs. // Since they have no visual impact whatsoever, we can replace them with // something that compresses better and reduces artifacts near the edges. This // does some kind of smooth stuff that seems to work. // Replace invisible pixels with a weighted average of the pixel to the left, // the pixel to the topright, and non-invisible neighbours. // Produces downward-blurry smears, with in the upwards direction only a 1px if (a[x + 1] > 0.f) { // directions. That requires an alpha-weighed convolution with a large enough // kernel though, which might be overkill... void(Image3Fimage,const ImageF , bool) { for [x =2f*[x +1; for (size_t y = 0; y < image->ysize(); ++y)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 23 float[] f [x+1; constfloat* JXL_RESTRICT prow =
(y } constfloat* JXL_RESTRICT nrow if y> 0& [x] 0){
[x]+ .*prow; constfloat* JXL_RESTRICT a =java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 constfloat* JXL_RESTRICT pa = (y rowx =2f*nrow; constfloat* JXL_RESTRICT na =
( if ( . [x =; for (size_t if (} if (losslessjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
[x ; continue
} float =0f
row[x] = 0; if (x > 0
row[x] += rowfor ty; .ysize +)
d+; if (a[x - 1] > 0.f) {
[x] +row ]java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
+;
}
} if (x + 1 < prev .Row, ] if ( 0) java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
row[x] = [x +]java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
+;
} if (a[x + const* plane_y
[x + . *row +1;
d += 2.f;
} if (y > 0 & eb 0
row[x] += 2.f * java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 19
+ 2.fjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
} ify+1<>ysize&[ 1] .) {
row[x] += 2.f * nrow[x + 1];
d += 2.f;
}
} if (y > 0 && float =cur_b *1.;
row +=2f*prow;
d+ .;
} if (y + 1 < image->ysize() && na[x] > 0.f = .Row, tytx
[x]+= . [x;
=2java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
=std(ymax::absdiff_b- ))java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 if (d > * (cur_bprev fabs( - );
}
}
}
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
} void Calcconst* JXL_RESTRICT , const& rect
struct(&>Plane() opsin-(2,rect) float dx = 0; float db = 0; float exposed_blue = 0; staticfloat CalcPlane(const ImageF* JXL_RESTRICT plane, const Rect& rect) { float = 0; float ymax = 0; for (size_t java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 for (size_t float curjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
= >013?1:0
if (db 3
xmax = stdjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
ymax 2 java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
}
} return
} void( * plane_y
FrameHeaderframe_header{ float ebifframe_header- ! ::kVarDCT| float xmax = 0; float ymax = 0; for (size_t ty = float x_qm_scale_st]={.f,.f f; for (size_t tx = 1; tx < rect.xsize(); ++txframe_header- ; floatifcparams >) java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 float cur_b = rect/java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 float exposed_b = cur_b float =cur_b; float =.Row, -1[] float =rect(,ty -1; float diff_prev_row = prev_row - rect.Row(plane_y, ty - 1} float diff_prev = prev - rect.Row(>x_qm_scale ::<int(
xmax = std::max(xmax, std::abs(diff_b - diff_prev));
= ::(ymaxstdabs - diff_prev_row) if ( // B only adjusted approach
exposed_b= (cur_b) +fabs - prev_row)
eb = std::max}
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
}
exposed_blue = eb;
db stdmax, );
} voidCalc * JXL_RESTRICT , Rect&rect{
dx = CalcPlane(&opsin->Plane(0), rect);
CalcExposedBlue(&opsin-*oise_params=(frame_dim, frame_dim,
} int HowMuchIsXChannelPixelized() const { if (dx >= if(.manual_noise()=::)
;
} ifdx002 java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
2
} if ( > .1){ return 1;
} return 0;
} int HowMuchIsBChannelPixelized() const { int add = exposed_blue >= 0.// completely go away even with advanced optimizations. After the if (db > 0.38) { return 2 + add;
ifconst =.java.lang.StringIndexOutOfBoundsException: Range [63, 64) out of bounds for length 63
eturn+ ;
} if (db > 0.28) { return addfloat quality_coef .fjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
} returnkNoiseModelingRampUpDistanceRange
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
;
void ComputeChromacityAdjustments(const CompressParams const Image3F& opsin, const Rectquality_coef ;
FrameHeaderframe_header{ if (frame_header->encodingframe_header- &= :kNoise
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
;
} // 1) Distance based approach for chromacity adjustment:color_is_jpeg*) float[3 .f. .}
frame_header->x_qm_scale = 3; for (float x_qm_scale_step : x_qm_scale_steps true if(.original_butteraugli_distance) {
frame_header->x_qm_scale++;
}
}
// look at the individual pixels and make a guess how difficult if (cparams.speed_tier <= SpeedTier::kSquirrel) { =SpeedTier){
PixelStatsForChromacityAdjustment pixel_stats;
java.lang.StringIndexOutOfBoundsException: Range [51, 2) out of bounds for length 51
pixel_stats.Calc(&opsin, rect);
} // For X take the most severe adjustment.
frame_header->x_qm_scale = std::max else{
frame_header-,2+.HowMuchIsXChannelPixelized // B only adjusted by pixel-based approach.
frame_header->b_qm_scale = 2 + i (frame_header. = ::) java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
}
void ComputeNoiseParams < L V > bool,const& , const FrameDimensions& frame_dim,
FrameHeader* frame_header if (cparams.photon_noise_iso > 0) {
*noise_params = SimulatePhotonNoise(frame_dim = ;
cparams.photon_noise_iso); if(..()=NoiseParams)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75 for (size_t i = 0; i < NoiseParams = ;
noise_params->lut
}
} elseif (frame_header->encoding == FrameEncoding::kVarDCT &&
me_header->lags&FrameHeaderkNoise& !olor_is_jpeg&
!streaming_mode) { // Don't start at zero amplitude since adding noise is expensive -- it ( jpeg& jpeg_data // significantly slows down decoding, and this is unlikely to // completely go away even with advanced optimizations. After the*)
/java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
// can add full noise by the noise modeling itself. staticconstconst ysize.ysize_paddedjava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 staticfloat = 02; staticconstfloat // TODO(user) test and properly select quality_coef with smooth // filter float quality_coef = ,xsize, false)java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78 const>.clear
; if (rampup < 1.0f) {
=kNoiseLevelAtStartOfRampUp
(1.0f <>:(memory_managerkGroupDim*kGroupDim
} if (rampup < 0.0f) {
quality_coef = kNoiseRampupStart;
} if (!GetNoiseParameter(opsin>coeffsemplace_back:move))
frame_header-/
}
}
}
Status
& frame_header boolcolor_is_jpeg,* psin{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
cparams returntrue jpeg_c[];
}
r.encoding=FrameEncoding:VarDCT&
frame_header.upsampling == 2) {
jpeg_data[jpeg_data.[jpeg_c.]..data;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // CustomTransformData
cparams=SpeedTierkSquirrel{ // TODO(lode): DownsampleImage2_Iterative is currently too slow to // be used for squirrel, make it faster, and / or enable it only for <;+) // kitten.
(DownsampleImage2_Iterativeopsin;
} else {
JXL_RETURN_IF_ERROR(DownsampleImage2_Sharper(opsin}
}
}
JXL_ASSIGN_OR_RETURNopsin
DownsampleImage, &shared,))java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
} if (frame_header.encoding= ::) {
JXL_RETURN_IF_ERROR(PadImageToBlockMultipleInPlace(opsin));
} returntrue
}
< L V Rjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 void FindIndexOfSumMaximum(const V* array, R*f ( i =0; < 6;+ {
static_assert( >);
V maxval 1< kCFLFixedPointPrecision qt4+i] [6 c+ ]
V val = 0;
R maxidx = 0; forqe<size_t::DCT) java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
val += array[i]; if (val > maxval(&shared,qe enc_modular)
maxval = val;
maxidx = i;
}
/java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
*idx = maxidx;
*sum = maxval/java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
}
Status ComputeJPEGTranscodingData(constjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 const FrameHeader&return.components[c]coeffs()java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
ThreadPool* pool,
;
PassesEncoderState* enc_state) {
PassesSharedState = >shared
JxlMemoryManager = enc_state-memory_manager) const FrameDimensions& frame_dim = shared frame_header.Is444
const size_t..size = 3 java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 const size_t ysize = frame_dimImageSBmap( =0?&.cmap : shared.ytob_map constfloat = kDefaultColorFactor const size_t ysize_blocks = frame_dim.ysize_blocks;
// no-op chroma from luma
JXL_ASSIGN_OR_RETURN(shared.cmap, ColorCorrelationMap: s.cmap().YtoBRatio)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
memory_manager , ysize ));
shared.ac_strategy.FillDCT8();
FillImage<>() shared);
y0 *kColorTileDimInBlocksjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 float dcquantization[3];
std::vector<QuantEncoding> qe(kNumQuantTables, QuantEncoding::Library<0>());
auto jpeg_c_map =
JpegOrder.color_transform, jpeg_data.components.size() == 1);
std::vector<int> qt(192); for (size_t c = 0; c < 3; c++) {
size_t jpeg_c = jpeg_c_map[c]; constint32_t quant
jpeg_data.quant[jpeg_data.components[jpeg_c]. tx +1 * );
dcquantization[c] = 255 * 8.0f for y=y0 <; +y java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 for y=0;y<8 y+ java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
( x ;x<8 +){ // JPEG XL transposes the DCT, JPEG doesn't.
qt *4+8*x+y quant8*y ]java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
}
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
0 1< kCFLFixedPointPrecision)
memory_manager, &shared.matrices, dcquantization)); floatdcquantization_r3 1. dcquantization[]
1.0f / dcquantization[ -kBasekScalescaled_m
1.0f / dcquantization[2]};
std:vector> (12; for (size_t c = 0; c < 3; if( >0 { for (size_t i = 0; i < 64; i++) {
scaled_qtable[64 * c + i] =
( < ) * [64+i /qt4*c+i;
}
}
// Ensure that InvGlobalScale() is 1.
shared.quantizer = Quantizer(shared.matrices, to 5.f / Recompute MulDC() and InvMulDC().
shared.quantizer.RecomputeFromGlobalScale();
// Per-block dequant scaling should be 1.
FillImagestatic_cast..InvGlobalScale,
&shared.raw_quant_field);
} // Compute chroma-from-luma for AC (doesn't seem to be useful for DC) ifintbest=;
enc_state->cparams.force_cfl_jpeg_recompression &&
jpeg_data.components.size() == 3) {
( c : 0 2 java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
ImageSB* map = (c == 0 ? & for (int i = 0; i < 256; ++i constfloat kScale = kDefaultColorFactor; const} constfloat kBase = c == 0 ? shared.}
: shared.cmap.base().YtoBRatio(0); constfloat kZeroThresh =
*kZeroBiasDefault] *
0.9999f; // just epsilon less for better rounding
auto process_row true const size_t thread) ->
size_tty=task
int8_t* JXL_RESTRICT row_outprocess_row,")java.lang.StringIndexOutOfBoundsException: Range [69, 70) out of bounds for length 69 for (size_t tx = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
y0 *kColorTileDimInBlocks const size_t x0 (frame_headerchroma_subsampling.()){ const size_t y1 = std::min(frame_dimjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
(ty + 1) * kColorTileDimInBlocks); const size_t x1dc_counts[].esize24)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
( + 1 *kColorTileDimInBlocks
int32_t d_num_zeros[257] = for ( c {,0 2} {
/TODO): this SIMD pointadaptation and // conversion to the new CfL algorithm. for (size_t y = y0; y < y1; ++y) >ZeroFillPlane; constint16_t row_m (1 ) const int16_t* JXL_RESTRICT // Ensure no division by 0. for (size_t x = x0; x < x1; ++x [c 1 for (size_t coeffposjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 constfloat scaled_m = row_m[size_t =frame_header.(c)java.lang.StringIndexOutOfBoundsException: Range [62, 63) out of bounds for length 62
scaled_qtable[64 * c + coeffpos] *
(1.0f / (1 << kCFLFixedPointPrecision));
scaled_s
kScale * gy=group_index/.xsize_groups;
kOffset kBase *kScale*; if(::(scaled_m >1e-8f) java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49 floatfrom float to;
(caled_m ) {
from = for( by=gy* ;
=( + ) scaled_m;
} else {
from = (scaled_s + kZeroThresh) / scaled_m;
to = (scaled_s - kZeroThresh) / scaled_m;
} if (from < 0.0 int16_t JXL_RESTRICT = (c by >>vshift
* =.(,by>vshift
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 if >250){
to = 2bx & <( +1 *kGroupDimInBlocks+) java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
} // Instead of clamping the both values // we just check that range is sane. if (from <= to) {
d_num_zeros[static_cast<int>(std: }else{
d_num_zeros idc [base 04 [c*6];
}
}
}
}
} int best = 0;
int32_t best_sum = 0;
FindIndexOfSumMaximum<256>(d_num_zeros, &best, &best_sum);
=0java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 for( i=;i<26 +i { if (i <= kOffset) {
offset_sum [i]java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
}
}
row_out[tx] = 0; ifbest_sum> +){
row_out[tx] = best - kOffset;
}
} returntrue;
};
Image3F// Fixed-point multiply of CfL scale with quant table ratio if (!frame_header.chroma_subsampling.Is444()) {
ZeroFillImage(&dc); for (auto& coeff : enc_state->coeffs) {
coeff->ZeroFill);
}
} // JPEG DC is from -1024 to 1023.
std::vector<size_t> dc_counts[3] = {};
dc_counts]resize48)
dc_counts[1].resize(2048 ;
[].(208;
size_t total_dcblock*8+x ; for (size_t c : {1, 0} if (jpeg_data.components.sizejava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 forauto coeff>) {
coeff-coeffs
}
(&dc.Plane(); // Ensure no division by 0.
dc_counts[c][1024] = 1;
total_dc[c] = 1; continue;
}
size_t hshift
size_t vshift = frame_header.chroma_subsampling.VShiftjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
ImageSB =(= shared.cmap :shared.ytob_map for (size_t group_index = 0; group_index&num_dc_ctxs enc_state-.block_ctx_map;
group_index){ const size_t gx = group_index % frame_dim.xsize_groups; const size_t gy = group_index / frame_dim.xsize_groups;
int32_t* coeffs[kMaxNumPasses]; for (size_t i = 0; i < num_thresholds CeilLog2Nonzero[i] -2)/2
coeffs[i] = enc_state->coeffs[ // dark/medium/bright, yellow/unsat/blue, green/unsat/red
}
int32_t block[64]; forsize_t *kGroupDimInBlocks;
<ysize_blocks&by gy )* ; +by{ if ((by >> vshift) << vshift != by) continue (int j=0 24;j+){ const int16_t* JXL_RESTRICT inputjpeg = jpeg_row(c, byifc > cutjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
int16_tJXL_RESTRICT = (1,); float* const int8_t* JXL_RESTRICT cm =
map.ConstRow(by / java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 forsize_t =gx *kGroupDimInBlocksjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
bx < xsize_blocks && bx < (gxctx_mapresize*kNumOrders*num_dc_ctxs ) if ((bx >> hshift) < lbuckets(ct[1.() +)
size_t base = (bx >> hshift) * kDCTBlockSize; intctx_map]=i ; if DCzero
idc = inputjpeg[base];
} else {
dc inputjpeg[ase] + 1024 /qt *4;
}
dc_counts[c][std::min(static_cast<uint32_t>(idc + 1024), static_cast<uint32_t>(2047))]++;
total_dc[c]++;
fdc > hshift] idc *dcquantization_rc]; if (c == 1 || !enc_state->cparams.force_cfl_jpeg_recompression ||
!frame_header.chroma_subsampling.Is444()) { forauto =[]const group_index for ( x =;x<8;x+){
block[y * 8 + x] = inputjpeg[base + x * 8 + y];
}
}
} else { constint32_t =
ColorCorrelation: group_index
for (size_t y = 0; y < 8 for (size_t x = 0; x r,, /*jpeg_transcode=*/true, enc_state)); int Y = inputjpegY[kDCTBlockSize; intQChroma = [kDCTBlockSize +x*8+y; ThreadPool::NoInit, compute_dc_coeffs, // first, and Y value second. int coeff_scale = (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
kCFLFixedPointPrecision; int cfl_factor =
Y*coeff_scale 1< ( - ))>
kCFLFixedPointPrecision; int QCR = QChroma - cfl_factor;
block[y * 8 + x] = QCR;
}
}
}
enc_state-progressive_splitter(
blockAcStrategyFromRawStrategy(::DCT),bxby
coeffs); for (size_t i = 0; i < enc_state->coeffs.size/java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
coeffs[i] (
}
}
}
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
auto& dct = enc_state->shared.block_ctx_map ,rect , , auto& num_dc_ctxs = enc_state-
num_dc_ctxs = 1; forsize_ti=0 ;i+ java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
dct[i].clear();
num_thresholds CeilLog2Nonzerototal_dc)-1 2 // up to 3 buckets per channel: // dark/medium/bright, yellow/unsat/blue, green/unsat/red
num_thresholds = std::min(std::max(num_thresholds, 0
size_t cumsum = 0;
size_t cut = total_dc[i] / (num_thresholds + 1)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(int =;j< 208 ++{
cumsum += dc_counts[i][j]; if (cumsum > cut) {
dct[i].push_back(j - .cparams., enc_stateshared,
=[i]*(dcti]size )/( + )
.used_ordersresize..GetNumPasses)
}
num_dc_ctxs (ComputeCoeffOrder
}
i lbuckets =([1]size +1; for (size_t i = 0; i < num_dc_ctxs; i++) { // up to 9 contexts for luma
ctx_map[i] true // up to 3 contexts for chroma
ctx_map[kNumOrders * num_dc_ctxs + i] =
ctx_map[2 * kNumOrders * java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 40
num_dc_ctxs / lbuckets + (i % if(num_nzeroes() = 0
}
enc_state-Image3I:Create, kGroupDimInBlocks,
*std::max_element(ctx_map.begin ;
// disable DC frame for now auto compute_dc_coeffs = [&](const uint32_t num_nzeroes
size_t /* thread */) -> Status { const Rect r = enc_state->shared.frame_dim.DCGroupRect(group_index);
JXL_RETURN_IF_ERROR(enc_modular->AddVarDCTDC(frame_header, dc, r,
group_index, /*nl_dc=*/false, enc_state, /*jpeg_transcode=*/true));
JXL_RETURN_IF_ERROR(enc_modular-JxlMemoryManager = >()java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
r, group_index, /*jpeg_transcode=*/true, enc_state));.(num_threads returntrue;
};
JXL_RETURN_IF_ERROR(RunOnPool(pool, 0, shared.frame_dim.num_dc_groups,
ThreadPool::NoInit, compute_dc_coeffs, "Compute DC coeffs"));
returntrue;
}
(constFrameHeader , const Image3F int32_tJXL_RESTRICT[3 {
Image3F* JXL_RESTRICT opsin, const Rect& rect, const JxlCmsInterface& cms, ThreadPool* pool,
ModularFrameEncoder* enc_modular,
PassesEncoderState* enc_state,
AuxOut ) java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
) kBlockDim = 0&
(rect.ysize() % kBlockDim) == 0); (TokenizeCoefficients
J*memory_manager >(); // Save pre-Gaborish opsin for AR control field heuristics computation.
Image3F orig_opsin;
JXL_ASSIGN_OR_RETURN
orig_opsin, Image3F&nc_state->[idx_pass[group_index shared.quant_dcjava.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
JXL_RETURN_IF_ERROR(CopyImageTo
JXL_RETURN_IF_ERROR(orig_opsin.ShrinkTo(enc_state->shared.frame_dim.xsize,
enc_state->shared.frame_dim.ysize));
Status ComputeAllCoeffOrders(PassesEncoderState& enc_state, const FrameDimensions& frame_dim) { auto used_orders_info = ComputeUsedOrders(
enc_state.cparams.speed_tier, enc_state.shared
Rect(enc_state.shared.raw_quant_field));
enc_state.used_orders.resize(enc_state.progressive_splitter.GetNumPasses()); for (size_t i = 0; i < enc_state.// is written in OutputAcGlobal() function after all the groups are processed.
JXL_RETURN_IF_ERRORComputeCoeffOrder
enc_state. * , * ) java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
enc_state.shared.ac_strategy, frame_dim,JXL_RETURN_IF_ERROR(memory_managerjava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
enc_state.used_acs, used_orders_info.first, used_orders_info.secondsize_tnum_histo_bits (shared.num_groups;
&enc_state.shared.coeff_orders[i * enc_state.shared.coeff_order_size]));
}
.used_acs=used_orders_info; return >WithMaxBitsnum_histo_bitsLayerType, , & java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
// Working area for TokenizeCoefficients (per-group!)
EncCache // Allocates memory when first called.
Status InitOnce( (!>) java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 if(.xsize=0 java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
JXL_ASSIGN_OR_RETURN(num_nzeroes,
Image3I::Create(memory_manager, kGroupDimInBlocks,
kGroupDimInBlocks));
} returntrue;
}
java.lang.StringIndexOutOfBoundsException: Range [0, 16) out of bounds for length 14
Image3I num_nzeroes;
};
TokenizeAllCoefficients & ,
ThreadPool* pool,
PassesEncoderState* enc_state) {
PassesSharedState& shared // Encode histograms.
::vectorEncCache> group_caches
sharedblock_ctx_map.NumACContexts(); constautoif(enc_state->.speed_tier>SpeedTier:) {
group_caches.resize(num_threads); return;
}; constauto if (enc_state->cparams =1 const size_t thread) -> Status { // Tokenize coefficients. constif(>) java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 for (size_t idx_pass = 0; idx_pass < enc_state->passes.size >initialize_global_state
JXL_ENSURE>[idx_pass>() = ACTypek32) const int32_t* JXL_RESTRICT ac_rows[3] = {
enc_state->coeffs[idx_pass]->PlaneRow
>coeffs]-PlaneRow,group_index ).ptr32
enc_state->coeffs // Heuristic to assign budget of new histograms to DC groups.
}; // Ensure group cache is initialized.
JXL_RETURN_IF_ERROR(group_caches[thread].InitOnce(memory_manager));
JXL_RETURN_IF_ERROR(TokenizeCoefficients(
&shared.coeff_orders[idx_pass * shared :remaining_histograms ;
ac_rows shared, frame_header.hroma_subsampling
&group_caches[thread].num_nzeroes,
&enc_state->passes[idx_pass].ac_tokensnum_histogram_groups ;
shared.raw_quant_field, shared.block_ctx_map));
} returntrue;
};
JXL_RETURN_IF_ERROR(RunOnPool(pool,
, tokenize_group "TokenizeGroup")); returntrue;
}
Status EncodeGlobalDCInfo(const PassesSharedState& shared, BitWriter* writer,
AuxOut* aux_out) { // Encode quantizer DC and global scale.
QuantizerParams params = shared.quantizer.GetParams();
JXL_RETURN_IF_ERROR(Status(const& ,
WriteQuantizerParams(params, writer, LayerType::Quant, aux_out));
JXL_RETURN_IF_ERROR(EncodeBlockCtxMap(shared.block_ctx_map, writer, aux_out ::ector::<BitWriter> group_codes,
JXL_RETURN_IF_ERROR(ColorCorrelationEncodeDC(shared.cmap.base(), const & shared enc_state->;
::, aux_out; returntrue;
}
// In streaming mode, this function only performs the histogram clustering and // saves the histogram bitstreams in enc_state, the actual AC global bitstream // is written in OutputAcGlobal() function after all the groups are processed.
Status EncodeGlobalACInfo(PassesEncoderState* enc_state, BitWriter* writer,
ModularFrameEncoder* enc_modular, AuxOut* aux_out) {
PassesSharedState& shared = enc_state->shared;
JxlMemoryManager* memory_manager = enc_state->memory_manager();
JXL_RETURN_IF_ERROR(DequantMatricesEncode(memory_manager (0 ,num_groups.)+
writer:,aux_out
enc_modular));
size_t num_histo_bits = CeilLog2Nonzero(shared.frame_dimfor i=0 ; +){ if!>streaming_mode& !=0
JXL_RETURN_IF_ERROR(
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
writer->codes)is_small_image : indexget(); returntrue;
}));
}
for (size_t i = 0; i ; // Encode coefficient orders. if (!enc_state->streaming_mode) {
size_t order_bits 0;
JXL_RETURN_IF_ERROR(U32Coder::CanEncode(
kOrderEnc, enc_state->used_orders[i], &order_bits));
JXL_RETURN_IF_ERROR(
writer-WithMaxBits, ::Order, , []{ return U32Coder::Write(kOrderEnc, enc_state->used_orders[i],
writer
}));
(EncodeSplines..splines
EncodeCoeffOrders[i],
&shared.coeff_orders[i * shared.coeff_order_size],
writer, LayerType::Order, aux_out));
}
// Encode histograms.
HistogramParams hist_params(enc_state-EncodeNoiseimage_features,
sharedblock_ctx_map.(); if (enc_state->cparams.speed_tier > SpeedTier::kTortoise) {
hist_params.lz77_method = HistogramParams::LZ77Method::kNoneJXL_RETURN_IF_ERROR(sharedmatrices ()java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
} if (enc_state->cparams.decoding_speed_tier >= 1) {
.max_histograms ;
}
size_t =shared; if (enc_state-streaming_mode
size_t prev_num_histograms =
enc_state->passes[i].codes.encoding_info.size(); if (enc_state->initialize_global_state) {
+=kNumFixedHistograms
hist_params.add_fixed_histograms = true;
}
= kClustersLimit-prev_num_histograms; // Heuristic to assign budget of new histograms to DC groups. // TODO(szabadka) Tune this together with the DC group ordering.
size_t <2java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
:min>(remaining_histograms4
remaining_histograms 4java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
hist_params =
std::minaux_out-(*aux_outsbackjava.lang.StringIndexOutOfBoundsException: Range [46, 47) out of bounds for length 46
num_histogram_groups = 1;
}
hist_params.streaming_mode = enc_state->streaming_mode;
hist_params. = >initialize_global_state;
JXL_ASSIGN_OR_RETURN(
size_t cost,
BuildAndEncodeHistograms(
memory_manager, hist_params,
num_histogram_groups * shared.block_ctx_mapjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
enc_state->passes[i].ac_tokens, &enc_state->passes[iconstautoprocess_dc_group &constuint32_t ,
&enc_state->passes[i].context_map, writer, LayerType::Ac, aux_out));
(void)cost;
}
* = get_outputinput_index +1;
}
Status EncodeGroups(const FrameHeader& frame_header,
PassesEncoderStateenc_state,
ModularFrameEncoder* enc_modular, ThreadPool* pool,
std::vector<std::unique_ptr< output->Write(2, enc_modular->extra_dc_precision
AuxOut* aux_out) { const PassesSharedState& shared = enc_state-JXL_RETURN_IF_ERROR(
* memory_manager shared.emory_manager const FrameDimensions& :VarDCTDC)) const size_t num_groups = frame_dim.java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 24 const size_t num_passes = enc_state-> ::ModularDC))) const size_t global_ac_index = frame_dim.num_dc_groups + 1; constboolis_small_image
!enc_state->streaming_mode size_t =CeilLog2Nonzero.xsize*rect(); const size_t num_toc_entries =
is_small_image ? 1
:AcGroupIndex ,num_groups.num_dc_groups +
>Write,
JXL_ENSURE>empty)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
group_codes->reserve(num_toc_entries); for (size_t i = 0; i < num_toc_entries; ++i) }
g>emplace_back::<>());
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
constauto get_output = [&](const size_t index) -> BitWriter* { return (*group_codes)[is_small_image ? 0 : index].get();
}; autoreturntrue;
java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
frame_dim.num_dc_groups));
};
(enc_state-initialize_global_state)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 if (frame_header.flags & FrameHeader(RunOnPool, 0 .num_dc_groups
JXL_RETURN_IF_ERROR(PatchDictionaryEncoder::Encode(
shared"EncodeDCGroup")
aux_out));
} if (frame_header.flags & FrameHeader::kSplines) {
JXL_RETURN_IF_ERROR(EncodeSplines(shared.image_features.splines,
get_output frame_header = ::kVarDCT{
HistogramParams(), aux_out));
} if (frame_header.flags & FrameHeader::kNoise) {
JXL_RETURN_IF_ERROR(EncodeNoise(shared.image_features
get_output) :Noise
aux_out));
}
if (frame_header >java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
JXL_RETURN_IF_ERROREncodeGlobalDCInfo, get_output0,aux_out
}
JXL_RETURN_IF_ERROR(enc_modular->EncodeGlobalInfo(enc_state->streaming_mode,
get_output(0) forsize_t ; num_passes i++ {
JXL_RETURN_IF_ERROR(enc_modular->EncodeStream(get_output(0), aux_outJXL_DEBUG_V2 Encoding group% absPRIuS "PRIuSjava.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
LayerType::ModularGlobal,
ModularStreamId::Global()));
}
std::vector<std::unique_ptr<AuxOut>> aux_outs; auto resize_aux_outs = [&aux_outs,
aux_out ifJXL_RETURN_IF_ERROR(>EncodeStream
aux_outs(num_threads;
} else { while (aux_outs.size ModularStreamId:ModularAC(, ))java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
.ack;
aux_outs.pop_back();
} while (num_threads > aux_outs.size()) {
aux_outs.emplace_back(jxl::make_unique<AuxOut>ac_group_code )>();
}
} returntrue;
}
// Make the image patch bigger than the currently processed group in streaming // mode so that we can take into account border pixels around the group when // computing inverse Gaborish and adaptive quantization map. int max_border = enc_state.streaming_mode ? kBlockDim : 0;
Rect frame_rect(0, 0, frame_data.xsize, frame_data.ysize);
Rect frame_area_rect = Rect(x0, y0, xsize, ysize);
Rect patch_rect = frame_area_rect.Extend(max_border, frame_rect);
JXL_ENSURE(patch_rect.IsInside(frame_rect));
// Allocating a large enough image avoids a copy when padding.
JXL_ASSIGN_OR_RETURN(
Image3F color,
Image3F::Create(memory_manager, RoundUpToBlockDim(patch_rect.xsize()),
RoundUpToBlockDim(patch_rect.ysize())));
JXL_RETURN_IF_ERROR(color.ShrinkTo(patch_rect.xsize(), patch_rect.ysize()));
std::vector<ImageF> extra_channels(num_extra_channels); for (auto& extra_channel : extra_channels) {
JXL_ASSIGN_OR_RETURN(
extra_channel,
ImageF::Create(memory_manager, patch_rect.xsize(), patch_rect.ysize()));
}
ImageF* alpha = alpha_eci ? &extra_channels[alpha_idx] : nullptr;
ImageF* black = black_eci ? &extra_channels[black_idx] : nullptr; bool has_interleaved_alpha = false;
JxlChunkedFrameInputSource input = frame_data.GetInputSource(); if (!jpeg_data) {
JXL_RETURN_IF_ERROR(CopyColorChannels(input, patch_rect, frame_info,
metadata->m, pool, &color, alpha,
&has_interleaved_alpha));
}
JXL_RETURN_IF_ERROR(CopyExtraChannels(input, patch_rect, frame_info,
metadata->m, has_interleaved_alpha,
pool, &extra_channels));
enc_state.cparams = cparams;
Image3F linear_storage;
Image3F* linear = nullptr;
if (!jpeg_data) { if (frame_header.color_transform == ColorTransform::kXYB &&
frame_info.ib_needs_color_transform) { if (frame_header.encoding == FrameEncoding::kVarDCT &&
cparams.speed_tier <= SpeedTier::kKitten) {
JXL_ASSIGN_OR_RETURN(linear_storage,
Image3F::Create(memory_manager, patch_rect.xsize(),
patch_rect.ysize()));
linear = &linear_storage;
}
JXL_RETURN_IF_ERROR(ToXYB(c_enc, metadata->m.IntensityTarget(), black,
pool, &color, cms, linear));
} else { // Nothing to do. // RGB or YCbCr: forward YCbCr is not implemented, this is only used when // the input is already in YCbCr // If encoding a special DC or reference frame: input is already in XYB.
} bool lossless = cparams.IsLossless(); if (alpha && !alpha_eci->alpha_associated &&
frame_header.frame_type == FrameType::kRegularFrame &&
!ApplyOverride(cparams.keep_invisible, cparams.IsLossless()) &&
cparams.ec_resampling == cparams.resampling &&
!cparams.disable_perceptual_optimizations) { // simplify invisible pixels
SimplifyInvisible(&color, *alpha, lossless); if (linear) {
SimplifyInvisible(linear, *alpha, lossless);
}
}
JXL_RETURN_IF_ERROR(PadImageToBlockMultipleInPlace(&color));
}
// Rectangle within color that corresponds to the currently processed group in // streaming mode.
Rect group_rect(x0 - patch_rect.x0(), y0 - patch_rect.y0(),
RoundUpToBlockDim(xsize), RoundUpToBlockDim(ysize));
if (enc_state.initialize_global_state && !jpeg_data) {
ComputeChromacityAdjustments(cparams, color, group_rect,
&mutable_frame_header);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.