Skip to content

Commit

Permalink
MMAL: fixup alignment with sand formats
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Sep 10, 2017
1 parent 3fd503b commit 5593da8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp
Expand Up @@ -188,11 +188,14 @@ int CDecoder::FFGetBuffer(AVCodecContext *avctx, AVFrame *frame, int flags)
{
int aligned_width = frame->width;
int aligned_height = frame->height;
// ffmpeg requirements
AlignedSize(dec->m_avctx, aligned_width, aligned_height);
// GPU requirements
aligned_width = ALIGN_UP(aligned_width, 32);
aligned_height = ALIGN_UP(aligned_height, 16);
if (pool->Encoding() != MMAL_ENCODING_YUVUV128 && pool->Encoding() != MMAL_ENCODING_YUVUV64_16)
{
// ffmpeg requirements
AlignedSize(dec->m_avctx, aligned_width, aligned_height);
// GPU requirements
aligned_width = ALIGN_UP(aligned_width, 32);
aligned_height = ALIGN_UP(aligned_height, 16);
}
pool->Configure(dec->m_fmt, frame->width, frame->height, aligned_width, aligned_height, 0);
}
CMMALYUVBuffer *YUVBuffer = dynamic_cast<CMMALYUVBuffer *>(pool->Get());
Expand Down
Expand Up @@ -69,8 +69,8 @@ class CMMALPool : public IVideoBufferPool
static uint32_t TranslateFormat(AVPixelFormat pixfmt);
virtual int Width() { return m_width; }
virtual int Height() { return m_height; }
virtual int AlignedWidth() { return m_geo.getStrideY() / m_geo.getBytesPerPixel(); }
virtual int AlignedHeight() { return m_geo.getHeightY(); }
virtual int AlignedWidth() { return m_mmal_format == MMAL_ENCODING_YUVUV128 || m_mmal_format == MMAL_ENCODING_YUVUV64_16 ? 0 : m_geo.getStrideY() / m_geo.getBytesPerPixel(); }
virtual int AlignedHeight() { return m_mmal_format == MMAL_ENCODING_YUVUV128 || m_mmal_format == MMAL_ENCODING_YUVUV64_16 ? 0 : m_geo.getHeightY(); }
virtual int BitsPerPixel() { return m_geo.getBitsPerPixel(); }
virtual uint32_t &Encoding() { return m_mmal_format; }
virtual int Size() { return m_size; }
Expand Down

0 comments on commit 5593da8

Please sign in to comment.