[FFmpeg-devel] [PATCH 2/2] Fix writing 12 bit DPX
Paul B Mahol
onemda at gmail.com
Sat Oct 6 00:03:55 CEST 2012
On 10/5/12, Georg Lippitsch <georg.lippitsch at gmx.at> wrote:
> The DPX encoder now writes 12 DPX that open correctly (tested with
> ImageMagick), and also correspond to the 12 bit sample files at
> http://samples.ffmpeg.org/image-samples/dpx_samples.zip
> ---
> libavcodec/dpxenc.c | 13 ++++++++++++-
> 1 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/libavcodec/dpxenc.c b/libavcodec/dpxenc.c
> index 451b7b9..85899f9 100644
> --- a/libavcodec/dpxenc.c
> +++ b/libavcodec/dpxenc.c
> @@ -148,14 +148,25 @@ static void encode_gbrp10(AVCodecContext *avctx, const
> AVPicture *pic, uint8_t *
>
> static void encode_gbrp12(AVCodecContext *avctx, const AVPicture *pic,
> uint16_t *dst)
> {
> + DPXContext *s = avctx->priv_data;
> const uint16_t *src[3] = {(uint16_t*)pic->data[0],
> (uint16_t*)pic->data[1],
> (uint16_t*)pic->data[2]};
> int x, y, i;
> for (y = 0; y < avctx->height; y++) {
> for (x = 0; x < avctx->width; x++) {
> + uint16_t value[3];
> + if (avctx->pix_fmt & 1) {
I do not like this.
> + value[1] = AV_RB16(src[0] + x) << 4;
> + value[2] = AV_RB16(src[1] + x) << 4;
> + value[0] = AV_RB16(src[2] + x) << 4;
> + } else {
> + value[1] = AV_RL16(src[0] + x) << 4;
> + value[2] = AV_RL16(src[1] + x) << 4;
> + value[0] = AV_RL16(src[2] + x) << 4;
> + }
> for (i = 0; i < 3; i++)
> - *dst++ = *(src[i] + x);
> + write16(dst++, value[i]);
> }
> for (i = 0; i < 3; i++)
> src[i] += pic->linesize[i]/2;
> --
> 1.7.7
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
More information about the ffmpeg-devel
mailing list