* commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa':
stereo3d: Support view type for frame sequence type
Merged-by: James Almer <jamrial@gmail.com>
| ... | ... |
@@ -15,6 +15,9 @@ libavutil: 2017-10-21 |
| 15 | 15 |
|
| 16 | 16 |
API changes, most recent first: |
| 17 | 17 |
|
| 18 |
+2017-xx-xx - xxxxxxx - lavu 56.4.100 / 56.7.0 - stereo3d.h |
|
| 19 |
+ Add view field to AVStereo3D structure and AVStereo3DView enum. |
|
| 20 |
+ |
|
| 18 | 21 |
2017-xx-xx - xxxxxxx - lavc 58.6.100 - avcodec.h |
| 19 | 22 |
Add const to AVCodecContext.hwaccel. |
| 20 | 23 |
|
| ... | ... |
@@ -322,10 +322,11 @@ static int decode_frame_packing_arrangement(H264SEIFramePacking *h, |
| 322 | 322 |
h->quincunx_sampling_flag = get_bits1(gb); |
| 323 | 323 |
h->content_interpretation_type = get_bits(gb, 6); |
| 324 | 324 |
|
| 325 |
- // the following skips: spatial_flipping_flag, frame0_flipped_flag, |
|
| 326 |
- // field_views_flag, current_frame_is_frame0_flag, |
|
| 325 |
+ // spatial_flipping_flag, frame0_flipped_flag, field_views_flag |
|
| 326 |
+ skip_bits(gb, 3); |
|
| 327 |
+ h->current_frame_is_frame0_flag = get_bits1(gb); |
|
| 327 | 328 |
// frame0_self_contained_flag, frame1_self_contained_flag |
| 328 |
- skip_bits(gb, 6); |
|
| 329 |
+ skip_bits(gb, 2); |
|
| 329 | 330 |
|
| 330 | 331 |
if (!h->quincunx_sampling_flag && h->frame_packing_arrangement_type != 5) |
| 331 | 332 |
skip_bits(gb, 16); // frame[01]_grid_position_[xy] |
| ... | ... |
@@ -125,6 +125,7 @@ typedef struct H264SEIFramePacking {
|
| 125 | 125 |
int frame_packing_arrangement_repetition_period; |
| 126 | 126 |
int content_interpretation_type; |
| 127 | 127 |
int quincunx_sampling_flag; |
| 128 |
+ int current_frame_is_frame0_flag; |
|
| 128 | 129 |
} H264SEIFramePacking; |
| 129 | 130 |
|
| 130 | 131 |
typedef struct H264SEIDisplayOrientation {
|
| ... | ... |
@@ -1233,6 +1233,13 @@ static int h264_export_frame_props(H264Context *h) |
| 1233 | 1233 |
|
| 1234 | 1234 |
if (fp->content_interpretation_type == 2) |
| 1235 | 1235 |
stereo->flags = AV_STEREO3D_FLAG_INVERT; |
| 1236 |
+ |
|
| 1237 |
+ if (fp->frame_packing_arrangement_type == 5) {
|
|
| 1238 |
+ if (fp->current_frame_is_frame0_flag) |
|
| 1239 |
+ stereo->view = AV_STEREO3D_VIEW_LEFT; |
|
| 1240 |
+ else |
|
| 1241 |
+ stereo->view = AV_STEREO3D_VIEW_RIGHT; |
|
| 1242 |
+ } |
|
| 1236 | 1243 |
} |
| 1237 | 1244 |
} |
| 1238 | 1245 |
|
| ... | ... |
@@ -95,10 +95,11 @@ static int decode_nal_sei_frame_packing_arrangement(HEVCSEIFramePacking *s, GetB |
| 95 | 95 |
s->quincunx_subsampling = get_bits1(gb); |
| 96 | 96 |
s->content_interpretation_type = get_bits(gb, 6); |
| 97 | 97 |
|
| 98 |
- // the following skips spatial_flipping_flag frame0_flipped_flag |
|
| 99 |
- // field_views_flag current_frame_is_frame0_flag |
|
| 100 |
- // frame0_self_contained_flag frame1_self_contained_flag |
|
| 101 |
- skip_bits(gb, 6); |
|
| 98 |
+ // spatial_flipping_flag, frame0_flipped_flag, field_views_flag |
|
| 99 |
+ skip_bits(gb, 3); |
|
| 100 |
+ s->current_frame_is_frame0_flag = get_bits1(gb); |
|
| 101 |
+ // frame0_self_contained_flag, frame1_self_contained_flag |
|
| 102 |
+ skip_bits(gb, 2); |
|
| 102 | 103 |
|
| 103 | 104 |
if (!s->quincunx_subsampling && s->arrangement_type != 5) |
| 104 | 105 |
skip_bits(gb, 16); // frame[01]_grid_position_[xy] |
| ... | ... |
@@ -2647,6 +2647,13 @@ static int set_side_data(HEVCContext *s) |
| 2647 | 2647 |
|
| 2648 | 2648 |
if (s->sei.frame_packing.content_interpretation_type == 2) |
| 2649 | 2649 |
stereo->flags = AV_STEREO3D_FLAG_INVERT; |
| 2650 |
+ |
|
| 2651 |
+ if (s->sei.frame_packing.arrangement_type == 5) {
|
|
| 2652 |
+ if (s->sei.frame_packing.current_frame_is_frame0_flag) |
|
| 2653 |
+ stereo->view = AV_STEREO3D_VIEW_LEFT; |
|
| 2654 |
+ else |
|
| 2655 |
+ stereo->view = AV_STEREO3D_VIEW_RIGHT; |
|
| 2656 |
+ } |
|
| 2650 | 2657 |
} |
| 2651 | 2658 |
|
| 2652 | 2659 |
if (s->sei.display_orientation.present && |
| ... | ... |
@@ -324,6 +324,8 @@ static int try_push_frame(AVFilterContext *ctx) |
| 324 | 324 |
if (!stereo) |
| 325 | 325 |
return AVERROR(ENOMEM); |
| 326 | 326 |
stereo->type = s->format; |
| 327 |
+ stereo->view = i == LEFT ? AV_STEREO3D_VIEW_LEFT |
|
| 328 |
+ : AV_STEREO3D_VIEW_RIGHT; |
|
| 327 | 329 |
|
| 328 | 330 |
// filter the frame and immediately relinquish its pointer |
| 329 | 331 |
ret = ff_filter_frame(outlink, s->input_views[i]); |
| ... | ... |
@@ -141,6 +141,25 @@ enum AVStereo3DType {
|
| 141 | 141 |
AV_STEREO3D_COLUMNS, |
| 142 | 142 |
}; |
| 143 | 143 |
|
| 144 |
+/** |
|
| 145 |
+ * List of possible view types. |
|
| 146 |
+ */ |
|
| 147 |
+enum AVStereo3DView {
|
|
| 148 |
+ /** |
|
| 149 |
+ * Frame contains two packed views. |
|
| 150 |
+ */ |
|
| 151 |
+ AV_STEREO3D_VIEW_PACKED, |
|
| 152 |
+ |
|
| 153 |
+ /** |
|
| 154 |
+ * Frame contains only the left view. |
|
| 155 |
+ */ |
|
| 156 |
+ AV_STEREO3D_VIEW_LEFT, |
|
| 157 |
+ |
|
| 158 |
+ /** |
|
| 159 |
+ * Frame contains only the right view. |
|
| 160 |
+ */ |
|
| 161 |
+ AV_STEREO3D_VIEW_RIGHT, |
|
| 162 |
+}; |
|
| 144 | 163 |
|
| 145 | 164 |
/** |
| 146 | 165 |
* Inverted views, Right/Bottom represents the left view. |
| ... | ... |
@@ -164,6 +183,11 @@ typedef struct AVStereo3D {
|
| 164 | 164 |
* Additional information about the frame packing. |
| 165 | 165 |
*/ |
| 166 | 166 |
int flags; |
| 167 |
+ |
|
| 168 |
+ /** |
|
| 169 |
+ * Determines which views are packed. |
|
| 170 |
+ */ |
|
| 171 |
+ enum AVStereo3DView view; |
|
| 167 | 172 |
} AVStereo3D; |
| 168 | 173 |
|
| 169 | 174 |
/** |
| ... | ... |
@@ -3,7 +3,7 @@ |
| 3 | 3 |
#codec_id 0: vp8 |
| 4 | 4 |
#dimensions 0: 320x213 |
| 5 | 5 |
#sar 0: 1/1 |
| 6 |
-0, 0, 0, 33, 2108, 0x59b92a34, S=2, 1900, 0x8fb3adc5, 8, 0x00000000 |
|
| 6 |
+0, 0, 0, 33, 2108, 0x59b92a34, S=2, 1900, 0x8fb3adc5, 12, 0x00000000 |
|
| 7 | 7 |
0, 32, 32, 33, 142, 0x2f2a3fed, F=0x0, S=1, 160, 0xa13346af |
| 8 | 8 |
0, 65, 65, 33, 157, 0x17804767, F=0x0, S=1, 209, 0x64115f15 |
| 9 | 9 |
0, 99, 99, 33, 206, 0x537262ca, F=0x0, S=1, 317, 0x44a09dd0 |