diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-03-02 01:28:03 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-03-02 01:35:16 +0000 |
| commit | d8f75e925541ef0c0a7861c90a681531368b89ab (patch) | |
| tree | 7588b254155f5ef34ae5fd4d2d5f601002a58bbc | |
| parent | 6ea03b494214a23c3f05a7fc1e80efa550d2359b (diff) | |
Fix corruption of subsampled images that are being placed into black
frames at odd offsets, using the same approach that is used when
cropping. Should fix #1227.
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | src/lib/image.cc | 15 | ||||
| m--------- | test/data | 0 |
3 files changed, 16 insertions, 5 deletions
@@ -1,4 +1,8 @@ -2018-02-28 Carl Hetherington <cth@carlh.net> +2018-03-02 Carl Hetherington <cth@carlh.net> + + * Fix bad Prores exports in some cases (#1227). + +2018-02-27 Carl Hetherington <cth@carlh.net> * Version 2.11.68 released. diff --git a/src/lib/image.cc b/src/lib/image.cc index 158bce1d9..792bf3ab4 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -183,8 +183,8 @@ Image::crop_scale_window ( 0, 1 << 16, 1 << 16 ); - AVPixFmtDescriptor const * desc = av_pix_fmt_desc_get (_pixel_format); - if (!desc) { + AVPixFmtDescriptor const * in_desc = av_pix_fmt_desc_get (_pixel_format); + if (!in_desc) { throw PixelFormatError ("crop_scale_window()", _pixel_format); } @@ -196,16 +196,23 @@ Image::crop_scale_window ( round down so that we don't crop a subsampled pixel until we've cropped all of its Y-channel pixels. */ - int const x = lrintf (bytes_per_pixel(c) * crop.left) & ~ ((int) desc->log2_chroma_w); + int const x = lrintf (bytes_per_pixel(c) * crop.left) & ~ ((int) in_desc->log2_chroma_w); scale_in_data[c] = data()[c] + x + stride()[c] * (crop.top / vertical_factor(c)); } /* Corner of the image within out_size */ Position<int> const corner ((out_size.width - inter_size.width) / 2, (out_size.height - inter_size.height) / 2); + AVPixFmtDescriptor const * out_desc = av_pix_fmt_desc_get (out_format); + if (!out_desc) { + throw PixelFormatError ("crop_scale_window()", out_format); + } + uint8_t* scale_out_data[out->planes()]; for (int c = 0; c < out->planes(); ++c) { - scale_out_data[c] = out->data()[c] + lrintf (out->bytes_per_pixel(c) * corner.x) + out->stride()[c] * (corner.y / out->vertical_factor(c)); + /* See the note in the crop loop above */ + int const x = lrintf (out->bytes_per_pixel(c) * corner.x) & ~ ((int) out_desc->log2_chroma_w); + scale_out_data[c] = out->data()[c] + x + out->stride()[c] * (corner.y / out->vertical_factor(c)); } sws_scale ( diff --git a/test/data b/test/data -Subproject 22ba7b14571926f6c3fd860df57ad2146d9ba40 +Subproject a6e0009c6e762d3bd27ebc6499b6e30fc4baea0 |
