History

avcodec/dovi_rpuenc: eliminate unnecessary loop

This struct itself contains vdr_rpu_id, so we can never match it except in the case of i == vdr_rpu_id. So just directly use this ID.

Niklas Haas committed 2 years ago

Commit fd00a561 parent bf924411 file · +1 −10Browse files

Unified · Split

libavcodec/dovi_rpuenc.c+1−10
@@ -463,16 +463,7 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, · 462 unmodified lines
463463 return AVERROR_INVALIDDATA;
464464 }
465465
466− vdr_rpu_id = -1;
467− for (int i = 0; i <= DOVI_MAX_DM_ID; i++) {
468− if (s->vdr[i] && !memcmp(s->vdr[i], mapping, sizeof(*mapping))) {
469− vdr_rpu_id = i;
470− break;
471− } else if (vdr_rpu_id < 0 && (!s->vdr[i] || i == DOVI_MAX_DM_ID)) {
472− vdr_rpu_id = i;
473− }
474− }
475−
466+ vdr_rpu_id = mapping->vdr_rpu_id;
476467 if (!s->vdr[vdr_rpu_id]) {
477468 s->vdr[vdr_rpu_id] = ff_refstruct_allocz(sizeof(AVDOVIDataMapping));
478469 if (!s->vdr[vdr_rpu_id])

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t