Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 3/9] avformat/matroska: Add macro for stereomode<->AVStereo3D correspondence
Date: Fri, 11 Aug 2023 12:43:22 +0200
Message-ID: <AS8P250MB074415C692405F59AF05A1C28F10A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB07441DD2024A768DE773EEFA8F10A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>

It will allow to create tables for easy conversion from AVStereo3D
to stereomode and back again as well as derive the properties
of a given stereomode.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroska.h | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index c5b5a4b310..3a1ee740ce 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -386,6 +386,43 @@ typedef struct CodecTags{
 extern const CodecTags ff_mkv_codec_tags[];
 extern const CodecTags ff_webm_codec_tags[];
 extern const AVMetadataConv ff_mkv_metadata_conv[];
+
+/* The following macro contains all the information about which
+ * MATROSKA_VIDEO_STEREOMODE_TYPE_* correspond to which AVStereo3D
+ * structures and also the relevant horizontal/vertical divisors
+ * as well as WebM compatibility.
+ *
+ * MAP and MKV_ONLY are macros to be provided by the user.
+ * MAP(MatroskaVideoStereoModeType, AVStereo3DType, AV_STEREO3D_FLAG_*,
+ *     HALF_WIDTH, HALF_HEIGHT, WebM-compatibility)
+ * is for the stereo modes that have a Stereo3D counterpart.
+ * MKV_ONLY(MatroskaVideoStereoModeType, HALF_WIDTH, HALF_HEIGHT, WebM)
+ * is for those that don't have a Stereo3D counterpart.
+ * */
+#define STEREOMODE_STEREO3D_MAPPING(MAP, MKV_ONLY)                                            \
+    MAP(MATROSKA_VIDEO_STEREOMODE_TYPE_MONO, AV_STEREO3D_2D, 0, 0, 0, 1)                      \
+    MAP(MATROSKA_VIDEO_STEREOMODE_TYPE_LEFT_RIGHT, AV_STEREO3D_SIDEBYSIDE, 0, 1, 0, 1)        \
+    MAP(MATROSKA_VIDEO_STEREOMODE_TYPE_BOTTOM_TOP, AV_STEREO3D_TOPBOTTOM,                     \
+        AV_STEREO3D_FLAG_INVERT, 0, 1, 1)                                                     \
+    MAP(MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM, AV_STEREO3D_TOPBOTTOM,  0, 0, 1, 1)        \
+    MAP(MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_RL, AV_STEREO3D_CHECKERBOARD,             \
+        AV_STEREO3D_FLAG_INVERT, 0, 0, 0)                                                     \
+    MAP(MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_LR, AV_STEREO3D_CHECKERBOARD, 0, 0, 0, 0) \
+    MAP(MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_RL, AV_STEREO3D_LINES,                 \
+        AV_STEREO3D_FLAG_INVERT, 0, 1, 0)                                                     \
+    MAP(MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_LR, AV_STEREO3D_LINES, 0, 0, 1, 0)     \
+    MAP(MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_RL, AV_STEREO3D_COLUMNS,               \
+        AV_STEREO3D_FLAG_INVERT, 1, 0, 0)                                                     \
+    MAP(MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_LR, AV_STEREO3D_COLUMNS, 0, 1, 0, 0)   \
+    MKV_ONLY(MATROSKA_VIDEO_STEREOMODE_TYPE_ANAGLYPH_CYAN_RED, 0, 0, 0)                       \
+    MAP(MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT, AV_STEREO3D_SIDEBYSIDE,                    \
+        AV_STEREO3D_FLAG_INVERT, 1, 0, 1)                                                     \
+    MKV_ONLY(MATROSKA_VIDEO_STEREOMODE_TYPE_ANAGLYPH_GREEN_MAG, 0, 0, 0)                      \
+    MAP(MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_LR, AV_STEREO3D_FRAMESEQUENCE,         \
+        0, 0, 0, 0)                                                                           \
+    MAP(MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_RL, AV_STEREO3D_FRAMESEQUENCE,         \
+        AV_STEREO3D_FLAG_INVERT, 0, 0, 0)
+
 extern const char * const ff_matroska_video_stereo_mode[MATROSKA_VIDEO_STEREOMODE_TYPE_NB];
 
 /* AVStream Metadata tag keys for WebM Dash Manifest */
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2023-08-11 10:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11 10:34 [FFmpeg-devel] [PATCH 1/9] avformat/matroskaenc: Avoid atoi() Andreas Rheinhardt
2023-08-11 10:43 ` [FFmpeg-devel] [PATCH 2/9] avformat/matroska: Move ff_matroska_video_stereo_plane to demuxer Andreas Rheinhardt
2023-08-11 10:43 ` Andreas Rheinhardt [this message]
2023-08-11 10:43 ` [FFmpeg-devel] [PATCH 4/9] avformat/matroskaenc: Don't add side-data to input stream Andreas Rheinhardt
2023-08-11 10:43 ` [FFmpeg-devel] [PATCH 5/9] avformat/matroskaenc: Improve message for WebM-incompatible StereoModes Andreas Rheinhardt
2023-08-11 10:43 ` [FFmpeg-devel] [PATCH 6/9] avformat/matroska: Move ff_mkv_stereo3d_conv() to demuxer Andreas Rheinhardt
2023-08-11 10:43 ` [FFmpeg-devel] [PATCH 7/9] avformat/matroskadec: Replace switch with array Andreas Rheinhardt
2023-08-11 10:43 ` [FFmpeg-devel] [PATCH 8/9] avformat/matroskadec: Use named constants instead of their value Andreas Rheinhardt
2023-08-11 13:20   ` Paul B Mahol
2023-08-11 10:43 ` [FFmpeg-devel] [PATCH 9/9] avformat/riffdec: Pass logctx as void* instead of AVFormatContext* Andreas Rheinhardt
2023-08-11 22:58 ` [FFmpeg-devel] [PATCH 10/11] fate/matroska: Add test for stereo 3D Andreas Rheinhardt
2023-08-12 16:27   ` Andreas Rheinhardt
2023-08-11 22:58 ` [FFmpeg-devel] [PATCH 11/11] fate/matroska: Fix requirements of fate-matroska-alac-remux test Andreas Rheinhardt
2023-08-13 23:00 ` [FFmpeg-devel] [PATCH 1/9] avformat/matroskaenc: Avoid atoi() Andreas Rheinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB074415C692405F59AF05A1C28F10A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git