1
0
Fork 0

avcodec/h264_sei, sei: Make H264_SEI_FpaType generic

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-06-29 12:24:28 +02:00
parent 3bafc4ead4
commit 38d0d12c46
5 changed files with 33 additions and 29 deletions

View File

@ -57,7 +57,7 @@ typedef struct H2645SEIFramePacking {
int present;
int arrangement_id;
int arrangement_cancel_flag; ///< is previous arrangement canceled, -1 if never received (currently H.264 only)
int arrangement_type;
SEIFpaType arrangement_type;
int arrangement_repetition_period;
int content_interpretation_type;
int quincunx_sampling_flag;

View File

@ -307,37 +307,37 @@ const char *ff_h264_sei_stereo_mode(const H2645SEIFramePacking *h)
{
if (h->arrangement_cancel_flag == 0) {
switch (h->arrangement_type) {
case H264_SEI_FPA_TYPE_CHECKERBOARD:
case SEI_FPA_H264_TYPE_CHECKERBOARD:
if (h->content_interpretation_type == 2)
return "checkerboard_rl";
else
return "checkerboard_lr";
case H264_SEI_FPA_TYPE_INTERLEAVE_COLUMN:
case SEI_FPA_H264_TYPE_INTERLEAVE_COLUMN:
if (h->content_interpretation_type == 2)
return "col_interleaved_rl";
else
return "col_interleaved_lr";
case H264_SEI_FPA_TYPE_INTERLEAVE_ROW:
case SEI_FPA_H264_TYPE_INTERLEAVE_ROW:
if (h->content_interpretation_type == 2)
return "row_interleaved_rl";
else
return "row_interleaved_lr";
case H264_SEI_FPA_TYPE_SIDE_BY_SIDE:
case SEI_FPA_TYPE_SIDE_BY_SIDE:
if (h->content_interpretation_type == 2)
return "right_left";
else
return "left_right";
case H264_SEI_FPA_TYPE_TOP_BOTTOM:
case SEI_FPA_TYPE_TOP_BOTTOM:
if (h->content_interpretation_type == 2)
return "bottom_top";
else
return "top_bottom";
case H264_SEI_FPA_TYPE_INTERLEAVE_TEMPORAL:
case SEI_FPA_TYPE_INTERLEAVE_TEMPORAL:
if (h->content_interpretation_type == 2)
return "block_rl";
else
return "block_lr";
case H264_SEI_FPA_TYPE_2D:
case SEI_FPA_H264_TYPE_2D:
default:
return "mono";
}

View File

@ -40,19 +40,6 @@ typedef enum {
H264_SEI_PIC_STRUCT_FRAME_TRIPLING = 8 ///< 8: %frame tripling
} H264_SEI_PicStructType;
/**
* frame_packing_arrangement types
*/
typedef enum {
H264_SEI_FPA_TYPE_CHECKERBOARD = 0,
H264_SEI_FPA_TYPE_INTERLEAVE_COLUMN = 1,
H264_SEI_FPA_TYPE_INTERLEAVE_ROW = 2,
H264_SEI_FPA_TYPE_SIDE_BY_SIDE = 3,
H264_SEI_FPA_TYPE_TOP_BOTTOM = 4,
H264_SEI_FPA_TYPE_INTERLEAVE_TEMPORAL = 5,
H264_SEI_FPA_TYPE_2D = 6,
} H264_SEI_FpaType;
typedef struct H264SEITimeCode {
/* When not continuously receiving full timecodes, we have to reference
the previous timecode received */

View File

@ -1235,28 +1235,28 @@ static int h264_export_frame_props(H264Context *h)
AVStereo3D *stereo = av_stereo3d_create_side_data(out);
if (stereo) {
switch (fp->arrangement_type) {
case H264_SEI_FPA_TYPE_CHECKERBOARD:
case SEI_FPA_H264_TYPE_CHECKERBOARD:
stereo->type = AV_STEREO3D_CHECKERBOARD;
break;
case H264_SEI_FPA_TYPE_INTERLEAVE_COLUMN:
case SEI_FPA_H264_TYPE_INTERLEAVE_COLUMN:
stereo->type = AV_STEREO3D_COLUMNS;
break;
case H264_SEI_FPA_TYPE_INTERLEAVE_ROW:
case SEI_FPA_H264_TYPE_INTERLEAVE_ROW:
stereo->type = AV_STEREO3D_LINES;
break;
case H264_SEI_FPA_TYPE_SIDE_BY_SIDE:
case SEI_FPA_TYPE_SIDE_BY_SIDE:
if (fp->quincunx_sampling_flag)
stereo->type = AV_STEREO3D_SIDEBYSIDE_QUINCUNX;
else
stereo->type = AV_STEREO3D_SIDEBYSIDE;
break;
case H264_SEI_FPA_TYPE_TOP_BOTTOM:
case SEI_FPA_TYPE_TOP_BOTTOM:
stereo->type = AV_STEREO3D_TOPBOTTOM;
break;
case H264_SEI_FPA_TYPE_INTERLEAVE_TEMPORAL:
case SEI_FPA_TYPE_INTERLEAVE_TEMPORAL:
stereo->type = AV_STEREO3D_FRAMESEQUENCE;
break;
case H264_SEI_FPA_TYPE_2D:
case SEI_FPA_H264_TYPE_2D:
stereo->type = AV_STEREO3D_2D;
break;
}
@ -1264,7 +1264,7 @@ static int h264_export_frame_props(H264Context *h)
if (fp->content_interpretation_type == 2)
stereo->flags = AV_STEREO3D_FLAG_INVERT;
if (fp->arrangement_type == H264_SEI_FPA_TYPE_INTERLEAVE_TEMPORAL) {
if (fp->arrangement_type == SEI_FPA_TYPE_INTERLEAVE_TEMPORAL) {
if (fp->current_frame_is_frame0_flag)
stereo->view = AV_STEREO3D_VIEW_LEFT;
else

View File

@ -137,4 +137,21 @@ enum SEIType {
SEI_TYPE_SAMPLE_ASPECT_RATIO_INFO = 204,
};
/**
* frame_packing_arrangement types. H.265 and H.274 use only 3..5
* with all the other values being reserved. H.264 uses a few more values
* that are prefixed with SEI_FPA_H264 in the enum below.
*
* The semantics of the common values are the same for all standards.
*/
typedef enum {
SEI_FPA_H264_TYPE_CHECKERBOARD = 0,
SEI_FPA_H264_TYPE_INTERLEAVE_COLUMN = 1,
SEI_FPA_H264_TYPE_INTERLEAVE_ROW = 2,
SEI_FPA_TYPE_SIDE_BY_SIDE = 3,
SEI_FPA_TYPE_TOP_BOTTOM = 4,
SEI_FPA_TYPE_INTERLEAVE_TEMPORAL = 5,
SEI_FPA_H264_TYPE_2D = 6,
} SEIFpaType;
#endif /* AVCODEC_SEI_H */