diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-09-12 22:19:33 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-09-12 22:19:46 +0200 |
commit | e2774b3e3b51dfe312daa4504dbc5358fd9601b4 (patch) | |
tree | bdc84c0520db21b8fbe3bdd5906fed9a686a36b5 /libavcodec | |
parent | 1b99514dfdc1d3fa60595b16d0e09c2b0b340ccb (diff) | |
parent | f99f7f40257c53f93a9b65725e37459db54178f9 (diff) |
Merge remote-tracking branch 'cehoyos/master'
* cehoyos/master:
Set bits_per_raw_sample when reading j2k frames.
libopenjpegdec.c: Correctly scale gray16 output if precision < 16
Use rc_max_rate if no video bit_rate was specified when muxing mxf_d10.
Store the video bit_rate in the context when muxing mxf.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/jpeg2000dec.c | 1 | ||||
-rw-r--r-- | libavcodec/libopenjpegdec.c | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index e67f098a6d..345c7e1ebe 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -350,6 +350,7 @@ static int get_siz(Jpeg2000DecoderContext *s) ncomponents > 2 ? s->cdx[2] : 0, ncomponents > 2 ? s->cdy[2] : 0); } + s->avctx->bits_per_raw_sample = s->precision; return 0; } diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index c331b590e8..27fb56e03f 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); + for (index = 0; index < image->numcomps; index++) { comp_data = image->comps[index].data; for (y = 0; y < image->comps[index].h; y++) { img_ptr = (uint16_t*) (picture->data[index] + y * picture->linesize[index]); for (x = 0; x < image->comps[index].w; x++) { - *img_ptr = *comp_data; + *img_ptr = *comp_data << adjust[index]; img_ptr++; comp_data++; } |