Commit 65528080 authored by Anton Khirnov's avatar Anton Khirnov

lavc,lavfi: fix calculating the plane size in the AVBufferRef wrappers

It is supposed to be height * linesize, not width * linesize.
Thanks to Hendrik Leppkes for pointing out the bug.
parent 23f4c5ac
...@@ -667,8 +667,8 @@ do { \ ...@@ -667,8 +667,8 @@ do { \
planes = (desc->flags & PIX_FMT_PLANAR) ? desc->nb_components : 1; planes = (desc->flags & PIX_FMT_PLANAR) ? desc->nb_components : 1;
for (i = 0; i < planes; i++) { for (i = 0; i < planes; i++) {
int h_shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0; int v_shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
int plane_size = (frame->width >> h_shift) * frame->linesize[i]; int plane_size = (frame->height >> v_shift) * frame->linesize[i];
WRAP_PLANE(frame->buf[i], frame->data[i], plane_size); WRAP_PLANE(frame->buf[i], frame->data[i], plane_size);
} }
......
...@@ -193,8 +193,8 @@ do { \ ...@@ -193,8 +193,8 @@ do { \
planes = (desc->flags & PIX_FMT_PLANAR) ? desc->nb_components : 1; planes = (desc->flags & PIX_FMT_PLANAR) ? desc->nb_components : 1;
for (i = 0; i < planes; i++) { for (i = 0; i < planes; i++) {
int h_shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0; int v_shift = (i == 1 || i == 2) ? desc->log2_chroma_w : 0;
int plane_size = (frame->width >> h_shift) * frame->linesize[i]; int plane_size = (frame->height >> v_shift) * frame->linesize[i];
WRAP_PLANE(frame->buf[i], frame->data[i], plane_size); WRAP_PLANE(frame->buf[i], frame->data[i], plane_size);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment