History

vo_gpu_next: add support for VOCTRL_HDR_METADATA

Kacper Michajłow committed 3 years ago

Commit 38ac6731 parent a98c5321 file · +34 −0Browse files

Unified · Split

video/out/vo_gpu_next.c+34−0
@@ -186,6 +186,8 @@ struct priv { · 185 unmodified lines
186186 bool target_hint;
187187
188188 float corner_rounding;
189+
190+ struct pl_hdr_metadata last_hdr_metadata;
189191 };
190192
191193 static void update_render_options(struct vo *vo);
@@ -1081,6 +1083,23 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame) · 889 unmodified lines
10811083 goto done;
10821084 }
10831085
1086+ const struct pl_frame *cur_frame = NULL;
1087+ for (int i = 0; i < mix.num_frames; i++) {
1088+ if (mix.timestamps[i] > 0.0f)
1089+ break;
1090+ cur_frame = mix.frames[i];
1091+ }
1092+
1093+ if (cur_frame) {
1094+ p->last_hdr_metadata = cur_frame->color.hdr;
1095+#if PL_API_VER >= 314
1096+ // Augment metadata with peak detection max_pq_y / avg_pq_y
1097+ pl_renderer_get_hdr_metadata(p->rr, &p->last_hdr_metadata);
1098+#endif
1099+ } else {
1100+ p->last_hdr_metadata = (struct pl_hdr_metadata){0};
1101+ }
1102+
10841103 p->is_interpolated = mix.num_frames > 1;
10851104 valid = true;
10861105 // fall through
@@ -1417,6 +1436,21 @@ static int control(struct vo *vo, uint32_t request, void *data) · 330 unmodified lines
14171436 return true;
14181437 }
14191438
1439+ case VOCTRL_HDR_METADATA: {
1440+ struct mp_hdr_metadata *hdr = data;
1441+ hdr->min_luma = p->last_hdr_metadata.min_luma;
1442+ hdr->max_luma = p->last_hdr_metadata.max_luma;
1443+ hdr->max_cll = p->last_hdr_metadata.max_cll;
1444+ hdr->max_fall = p->last_hdr_metadata.max_fall;
1445+ hdr->scene_max[0] = p->last_hdr_metadata.scene_max[0];
1446+ hdr->scene_max[1] = p->last_hdr_metadata.scene_max[1];
1447+ hdr->scene_max[2] = p->last_hdr_metadata.scene_max[2];
1448+ hdr->scene_avg = p->last_hdr_metadata.scene_avg;
1449+ hdr->max_pq_y = p->last_hdr_metadata.max_pq_y;
1450+ hdr->avg_pq_y = p->last_hdr_metadata.avg_pq_y;
1451+ return true;
1452+ }
1453+
14201454 case VOCTRL_SCREENSHOT:
14211455 video_screenshot(vo, data);
14221456 return true;

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