[FFmpeg-cvslog] libopenjpegdec.c: Correctly scale gray16 output if precision < 16

Clément Bœsch u at pkh.me
Thu Sep 12 22:36:40 CEST 2013


On Thu, Sep 12, 2013 at 10:28:01PM +0200, Michael Bradshaw wrote:
> ffmpeg | branch: master | Michael Bradshaw <mjbshaw at gmail.com> | Thu Sep 12 09:21:51 2013 +0200| [7412a4a48f23fd1a08fd30e75bbf116b6186fef9] | committer: Carl Eugen Hoyos
> 
> libopenjpegdec.c: Correctly scale gray16 output if precision < 16
> 
> Fixes ticket #2943.
> 
> Signed-off-by: Carl Eugen Hoyos <cehoyos at ag.or.at>
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7412a4a48f23fd1a08fd30e75bbf116b6186fef9
> ---
> 
>  libavcodec/libopenjpegdec.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
> index c331b59..27fb56e 100644
> --- a/libavcodec/libopenjpegdec.c
> +++ b/libavcodec/libopenjpegdec.c
> @@ -207,12 +207,16 @@ static inline void libopenjpeg_copyto16(AVFrame *picture, opj_image_t *image) {
>      int *comp_data;
>      uint16_t *img_ptr;
>      int index, x, y;
> +    int adjust[4];
> +    for (x = 0; x < image->numcomps; x++)

> +        adjust[x] = FFMAX(FFMIN(16 - image->comps[x].prec, 8), 0);

Any reason not to use av_clip()?

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-cvslog/attachments/20130912/502069a2/attachment.asc>


More information about the ffmpeg-cvslog mailing list