From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 5B1C943160 for ; Mon, 20 Jun 2022 21:06:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 60B0E68B603; Tue, 21 Jun 2022 00:06:09 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C9D3968B335 for ; Tue, 21 Jun 2022 00:06:02 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 1C728E747C for ; Mon, 20 Jun 2022 23:06:03 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ETcl_qhlILfi for ; Mon, 20 Jun 2022 23:06:01 +0200 (CEST) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id 1DA66E6FA6 for ; Mon, 20 Jun 2022 23:06:00 +0200 (CEST) Date: Mon, 20 Jun 2022 23:06:00 +0200 (CEST) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: <20220612171845.8122-1-cus@passwd.hu> Message-ID: <151e762-ce39-d9bf-843e-919c6473899f@passwd.hu> References: <20220612171845.8122-1-cus@passwd.hu> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 1/7] avcodec/v210dec: properly support odd widths X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Sun, 12 Jun 2022, Marton Balint wrote: > Fixes ticket #5195. > > Signed-off-by: Marton Balint > --- > libavcodec/v210dec.c | 49 +++++++++++++++++++++++++++++--------------- > 1 file changed, 33 insertions(+), 16 deletions(-) Will apply the series. Regards, Marton > > diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c > index 6c10ef6a7c..48ebe57100 100644 > --- a/libavcodec/v210dec.c > +++ b/libavcodec/v210dec.c > @@ -60,14 +60,16 @@ static int v210_decode_slice(AVCodecContext *avctx, void *arg, int jobnr, int th > int slice_start = (avctx->height * jobnr) / s->thread_count; > int slice_end = (avctx->height * (jobnr+1)) / s->thread_count; > uint8_t *psrc = td->buf + stride * slice_start; > - uint16_t *y, *u, *v; > + int16_t *py = (uint16_t*)frame->data[0] + slice_start * frame->linesize[0] / 2; > + int16_t *pu = (uint16_t*)frame->data[1] + slice_start * frame->linesize[1] / 2; > + int16_t *pv = (uint16_t*)frame->data[2] + slice_start * frame->linesize[2] / 2; > > - y = (uint16_t*)frame->data[0] + slice_start * frame->linesize[0] / 2; > - u = (uint16_t*)frame->data[1] + slice_start * frame->linesize[1] / 2; > - v = (uint16_t*)frame->data[2] + slice_start * frame->linesize[2] / 2; > for (h = slice_start; h < slice_end; h++) { > const uint32_t *src = (const uint32_t*)psrc; > uint32_t val; > + uint16_t *y = py; > + uint16_t *u = pu; > + uint16_t *v = pv; > > w = (avctx->width / 12) * 12; > s->unpack_frame(src, y, u, v, w); > @@ -85,25 +87,40 @@ static int v210_decode_slice(AVCodecContext *avctx, void *arg, int jobnr, int th > w += 6; > } > > - if (w < avctx->width - 1) { > + if (w++ < avctx->width) { > READ_PIXELS(u, y, v); > > - val = av_le2ne32(*src++); > - *y++ = val & 0x3FF; > - if (w < avctx->width - 3) { > - *u++ = (val >> 10) & 0x3FF; > - *y++ = (val >> 20) & 0x3FF; > - > + if (w++ < avctx->width) { > val = av_le2ne32(*src++); > - *v++ = val & 0x3FF; > - *y++ = (val >> 10) & 0x3FF; > + *y++ = val & 0x3FF; > + > + if (w++ < avctx->width) { > + *u++ = (val >> 10) & 0x3FF; > + *y++ = (val >> 20) & 0x3FF; > + val = av_le2ne32(*src++); > + *v++ = val & 0x3FF; > + > + if (w++ < avctx->width) { > + *y++ = (val >> 10) & 0x3FF; > + > + if (w++ < avctx->width) { > + *u++ = (val >> 20) & 0x3FF; > + val = av_le2ne32(*src++); > + *y++ = val & 0x3FF; > + *v++ = (val >> 10) & 0x3FF; > + > + if (w++ < avctx->width) > + *y++ = (val >> 20) & 0x3FF; > + } > + } > + } > } > } > > psrc += stride; > - y += frame->linesize[0] / 2 - avctx->width + (avctx->width & 1); > - u += frame->linesize[1] / 2 - avctx->width / 2; > - v += frame->linesize[2] / 2 - avctx->width / 2; > + py += frame->linesize[0] / 2; > + pu += frame->linesize[1] / 2; > + pv += frame->linesize[2] / 2; > } > > return 0; > -- > 2.34.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".