Message ID | 20220318021309.12878-1-jamrial@gmail.com |
---|---|
State | Accepted |
Commit | 5021b2ba0653cc97165f40b2cf247cbf5122aae0 |
Headers | show |
Series | [FFmpeg-devel] avcodec/dfa: don't check for the bitstream version on every copied line | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_aarch64_jetson | success | Make finished |
andriy/make_fate_aarch64_jetson | success | Make fate finished |
andriy/make_armv7_RPi4 | success | Make finished |
andriy/make_fate_armv7_RPi4 | success | Make fate finished |
On 3/17/2022 11:13 PM, James Almer wrote: > And use av_image_copy_plane() while at it to simplify things for > version != 0x100. > > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavcodec/dfa.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c > index ab78d66763..c29eb76de5 100644 > --- a/libavcodec/dfa.c > +++ b/libavcodec/dfa.c > @@ -385,8 +385,8 @@ static int dfa_decode_frame(AVCodecContext *avctx, > > buf = s->frame_buf; > dst = frame->data[0]; > - for (i = 0; i < avctx->height; i++) { > - if(version == 0x100) { > + if (version == 0x100) { > + for (i = 0; i < avctx->height; i++) { > int j; > const uint8_t *buf1 = buf + (i&3)*(avctx->width/4) + (i/4)*avctx->width; > int stride = (avctx->height/4)*avctx->width; > @@ -400,12 +400,12 @@ static int dfa_decode_frame(AVCodecContext *avctx, > for(; j < avctx->width; j++) { > dst[j] = buf1[(j/4) + (j&3)*stride]; > } > - } else { > - memcpy(dst, buf, avctx->width); > - buf += avctx->width; > + dst += frame->linesize[0]; > } > - dst += frame->linesize[0]; > - } > + } else > + av_image_copy_plane(dst, frame->linesize[0], buf, avctx->width, > + avctx->width, avctx->height); > + > memcpy(frame->data[1], s->pal, sizeof(s->pal)); > > *got_frame = 1; Will apply.
diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c index ab78d66763..c29eb76de5 100644 --- a/libavcodec/dfa.c +++ b/libavcodec/dfa.c @@ -385,8 +385,8 @@ static int dfa_decode_frame(AVCodecContext *avctx, buf = s->frame_buf; dst = frame->data[0]; - for (i = 0; i < avctx->height; i++) { - if(version == 0x100) { + if (version == 0x100) { + for (i = 0; i < avctx->height; i++) { int j; const uint8_t *buf1 = buf + (i&3)*(avctx->width/4) + (i/4)*avctx->width; int stride = (avctx->height/4)*avctx->width; @@ -400,12 +400,12 @@ static int dfa_decode_frame(AVCodecContext *avctx, for(; j < avctx->width; j++) { dst[j] = buf1[(j/4) + (j&3)*stride]; } - } else { - memcpy(dst, buf, avctx->width); - buf += avctx->width; + dst += frame->linesize[0]; } - dst += frame->linesize[0]; - } + } else + av_image_copy_plane(dst, frame->linesize[0], buf, avctx->width, + avctx->width, avctx->height); + memcpy(frame->data[1], s->pal, sizeof(s->pal)); *got_frame = 1;
And use av_image_copy_plane() while at it to simplify things for version != 0x100. Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/dfa.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)