]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_uspp.c
avfilter/xbr: refactor px calculation in FILT[234]
[ffmpeg] / libavfilter / vf_uspp.c
index 4447a82ba5628d444627bbc4640d7feebb760db0..ffd340a4cb60f6a66ef7be5116faa9310c41966c 100644 (file)
@@ -271,6 +271,9 @@ static void filter(USPPContext *p, uint8_t *dst[3], uint8_t *src[3],
             for (x = 0; x < width; x++)
                 p->temp[0][x + y * p->temp_stride[0]] += p->frame_dec->data[0][x + y * p->frame_dec->linesize[0] + offset];
 
+        if (!src[2] || !dst[2])
+            continue;
+
         offset = (BLOCKc-x1c) + (BLOCKc-y1c) * p->frame_dec->linesize[1];
 
         for (y = 0; y < height>>p->vsub; y++) {
@@ -332,9 +335,9 @@ static int config_input(AVFilterLink *inlink)
         int h = ((height + 4 * BLOCK-1) & (~(2 * BLOCK-1))) >> (is_chroma ? uspp->vsub : 0);
 
         uspp->temp_stride[i] = w;
-        if (!(uspp->temp[i] = av_malloc(uspp->temp_stride[i] * h * sizeof(int16_t))))
+        if (!(uspp->temp[i] = av_malloc_array(uspp->temp_stride[i], h * sizeof(int16_t))))
             return AVERROR(ENOMEM);
-        if (!(uspp->src [i] = av_malloc(uspp->temp_stride[i] * h * sizeof(uint8_t))))
+        if (!(uspp->src [i] = av_malloc_array(uspp->temp_stride[i], h * sizeof(uint8_t))))
             return AVERROR(ENOMEM);
     }