X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fj2k_image_proxy.cc;h=31fda2510492d9285f8987c73a41acd9551a5435;hp=d4c7a8716d7a6dae7876d3b07030b0a0f8a79fde;hb=7b0372776ac4da6a8e4ff29f41a4f08b9b4de506;hpb=25d968fdcf1abada4bd7bbcb8c72eeebda73b134 diff --git a/src/lib/j2k_image_proxy.cc b/src/lib/j2k_image_proxy.cc index d4c7a8716..31fda2510 100644 --- a/src/lib/j2k_image_proxy.cc +++ b/src/lib/j2k_image_proxy.cc @@ -137,14 +137,7 @@ J2KImageProxy::prepare (optional target_size) const } shared_ptr decompressed = dcp::decompress_j2k (const_cast (_data.data().get()), _data.size (), reduce); - - /* When scaling JPEG2000 images (using AV_PIX_FMT_XYZ12LE) ffmpeg will call xyz12ToRgb48 which reads data - from the whole of the image stride. If we are cropping, Image::crop_scale_window munges the - start addresses of each image row (to do the crop) but keeps the stride the same. This means - that under crop we will read over the end of the image by the amount of the crop. To allow this - to happen without invalid memory access we need to overallocate by one whole stride's worth of pixels. - */ - _image.reset (new Image (_pixel_format, decompressed->size(), true, decompressed->size().width)); + _image.reset (new Image (_pixel_format, decompressed->size(), true)); int const shift = 16 - decompressed->precision (0);