summaryrefslogtreecommitdiff
path: root/ffplay.c
diff options
context:
space:
mode:
authorOskar Arvidsson <oskar@irock.se>2011-03-29 17:48:57 +0200
committerRonald S. Bultje <rsbultje@gmail.com>2011-05-10 07:24:33 -0400
commit6e3ef511d787ff632547059f8730396ff4498e70 (patch)
treebda396b13aaa01e8dccbd60d697a543eff7643db /ffplay.c
parent44ca80df3445a59bc065924d8c6110fa10367d01 (diff)
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: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ffplay.c b/ffplay.c
index a09431915a..11b307eaca 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1577,6 +1577,7 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
int perms = AV_PERM_WRITE;
int i, w, h, stride[4];
unsigned edge;
+ int pixel_size;
if (codec->codec->capabilities & CODEC_CAP_NEG_LINESIZES)
perms |= AV_PERM_NEG_LINESIZES;
@@ -1598,6 +1599,7 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
if(!(ref = avfilter_get_video_buffer(ctx->outputs[0], perms, w, h)))
return -1;
+ pixel_size = av_pix_fmt_descriptors[ref->format].comp[0].step_minus1+1;
ref->video->w = codec->width;
ref->video->h = codec->height;
for(i = 0; i < 4; i ++) {
@@ -1605,7 +1607,7 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
unsigned vshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_h : 0;
if (ref->data[i]) {
- ref->data[i] += (edge >> hshift) + ((edge * ref->linesize[i]) >> vshift);
+ ref->data[i] += ((edge * pixel_size) >> hshift) + ((edge * ref->linesize[i]) >> vshift);
}
pic->data[i] = ref->data[i];
pic->linesize[i] = ref->linesize[i];