Various optimized DSP functions read one line past the aligned picture.
Several ARMv6 put_pixels functions in HpelDSPContext load the input of
the next line while processing the current one. Explicitly allow this
for all codecs and not just H264.

Bug-Id: 646
CC: [email protected]
---
 libavcodec/utils.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index c88b346..98a977a 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -182,6 +182,7 @@ int ff_side_data_update_matrix_encoding(AVFrame *frame,
 void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
                                int linesize_align[AV_NUM_DATA_POINTERS])
 {
+    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt);
     int i;
     int w_align = 1;
     int h_align = 1;
@@ -265,9 +266,11 @@ void avcodec_align_dimensions2(AVCodecContext *s, int 
*width, int *height,
 
     *width  = FFALIGN(*width, w_align);
     *height = FFALIGN(*height, h_align);
-    if (s->codec_id == AV_CODEC_ID_H264)
-        // some of the optimized chroma MC reads one line too much
-        *height += 2;
+
+    /* Some optimized dsp functions reads one line too much (H264 chroma mc,
+     * ARM put_pixels functions, ...).
+     */
+    *height += 1 << decs->log2_chroma_h;
 
     for (i = 0; i < 4; i++)
         linesize_align[i] = STRIDE_ALIGN;
-- 
1.9.0

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to