1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

Avoid calling functions repeatedly via FFMIN

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-06-13 01:55:40 +02:00
parent e1836b191b
commit f9136d6026
3 changed files with 7 additions and 4 deletions

View File

@ -1044,7 +1044,9 @@ static void handle_p_frame_png(PNGDecContext *s, AVFrame *p)
int i, j;
uint8_t *pd = p->data[0];
uint8_t *pd_last = s->last_picture.f->data[0];
int ls = FFMIN(av_image_get_linesize(p->format, s->width, 0), s->width * s->bpp);
int ls = av_image_get_linesize(p->format, s->width, 0);
ls = FFMIN(ls, s->width * s->bpp);
ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
for (j = 0; j < s->height; j++) {

View File

@ -57,10 +57,10 @@ static int afc_read_header(AVFormatContext *s)
static int afc_read_packet(AVFormatContext *s, AVPacket *pkt)
{
AFCDemuxContext *c = s->priv_data;
int64_t size;
int64_t size = c->data_end - avio_tell(s->pb);
int ret;
size = FFMIN(c->data_end - avio_tell(s->pb), 18 * 128);
size = FFMIN(size, 18 * 128);
if (size <= 0)
return AVERROR_EOF;

View File

@ -362,7 +362,8 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end)
uint16_t size = avio_rl16(s->pb);
const char *name = NULL;
char buffer[64] = { 0 };
size = FFMIN(size, tag_end - avio_tell(s->pb));
uint64_t remaining = tag_end - avio_tell(s->pb);
size = FFMIN(size, remaining);
size -= avio_read(s->pb, buffer,
FFMIN(size, sizeof(buffer) - 1));
switch (tag) {