diff options
author | Oskar Arvidsson <oskar@irock.se> | 2011-03-29 17:48:57 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-04-10 22:33:41 +0200 |
commit | dc172ecc6e59fb3e53af2991e00e0e81fe3c8884 (patch) | |
tree | 2c71000c44f1981d35224464b77a465dff38c7da /libavcodec/utils.c | |
parent | 86b0d9cd58137fc499f263267c3219ac6186b98e (diff) | |
download | ffmpeg-dc172ecc6e59fb3e53af2991e00e0e81fe3c8884.tar.gz |
Add the notion of pixel size in h264 related functions.
In high bit depth the pixels will not be stored in uint8_t like in the
normal case, but in uint16_t. The pixel size is thus 1 in normal bit
depth and 2 in high bit depth.
Preparatory patch for high bit depth h264 decoding support.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 031c3ff11d..3fa012dde4 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -286,6 +286,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ int unaligned; AVPicture picture; int stride_align[4]; + const int pixel_size = av_pix_fmt_descriptors[s->pix_fmt].comp[0].step_minus1+1; avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift); @@ -335,7 +336,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ if((s->flags&CODEC_FLAG_EMU_EDGE) || !size[2]) buf->data[i] = buf->base[i]; else - buf->data[i] = buf->base[i] + FFALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), stride_align[i]); + buf->data[i] = buf->base[i] + FFALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (pixel_size*EDGE_WIDTH>>h_shift), stride_align[i]); } if(size[1] && !size[2]) ff_set_systematic_pal2((uint32_t*)buf->data[1], s->pix_fmt); |