History

avcodec/hevc/refs: export Stereo 3D side data

Use the 3D Reference Displays Info SEI message to link a view_id with an eye.

James Almer committed 2 years ago

Commit aef221b1 parent 14746872 files · +19 −0Browse files

Showing the changes to libavcodec (2 of 2 files). Show all

Unified · Split

2 files
  1. libavcodec/hevc/hevcdec.c +1 −0
  2. libavcodec/hevc/refs.c +18 −0
libavcodec/hevc/hevcdec.c+1−0
@@ -3970,6 +3970,7 @@ static int hevc_update_thread_context(AVCodecContext *dst, · 3969 unmodified lines
39703970 s->sei.common.mastering_display = s0->sei.common.mastering_display;
39713971 s->sei.common.content_light = s0->sei.common.content_light;
39723972 s->sei.common.aom_film_grain = s0->sei.common.aom_film_grain;
3973+ s->sei.tdrdi = s0->sei.tdrdi;
39733974
39743975 return 0;
39753976 }
libavcodec/hevc/refs.c+18−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 */
2323
2424 #include "libavutil/mem.h"
25+#include "libavutil/stereo3d.h"
2526
2627 #include "container_fifo.h"
2728 #include "decode.h"
@@ -103,6 +104,7 @@ static HEVCFrame *alloc_frame(HEVCContext *s, HEVCLayerContext *l) · 75 unmodified lines
103104
104105 // add view ID side data if it's nontrivial
105106 if (vps->nb_layers > 1 || view_id) {
107+ HEVCSEITDRDI *tdrdi = &s->sei.tdrdi;
106108 AVFrameSideData *sd = av_frame_side_data_new(&frame->f->side_data,
107109 &frame->f->nb_side_data,
108110 AV_FRAME_DATA_VIEW_ID,
@@ -110,6 +112,22 @@ static HEVCFrame *alloc_frame(HEVCContext *s, HEVCLayerContext *l) · 1 unmodified line
110112 if (!sd)
111113 goto fail;
112114 *(int*)sd->data = view_id;
115+
116+ if (tdrdi->num_ref_displays) {
117+ AVStereo3D *stereo_3d;
118+
119+ stereo_3d = av_stereo3d_create_side_data(frame->f);
120+ if (!stereo_3d)
121+ goto fail;
122+
123+ stereo_3d->type = AV_STEREO3D_FRAMESEQUENCE;
124+ if (tdrdi->left_view_id[0] == view_id)
125+ stereo_3d->view = AV_STEREO3D_VIEW_LEFT;
126+ else if (tdrdi->right_view_id[0] == view_id)
127+ stereo_3d->view = AV_STEREO3D_VIEW_RIGHT;
128+ else
129+ stereo_3d->view = AV_STEREO3D_VIEW_UNSPEC;
130+ }
113131 }
114132
115133 ret = ff_progress_frame_get_buffer(s->avctx, &frame->tf,

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