[FFmpeg-cvslog] fate/mov: enable the AVIF tests

2024-01-09 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Jan  9 09:33:08 
2024 -0300| [bb819a4ef8ddd0a261f4eb9290a4b350a830450e] | committer: James Almer

fate/mov: enable the AVIF tests

The samples were uploaded long ago, but this was forgotten.

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bb819a4ef8ddd0a261f4eb9290a4b350a830450e
---

 tests/fate/mov.mak | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index c8e85fd54b..8541b05b29 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -18,10 +18,8 @@ FATE_MOV = fate-mov-3elist \
fate-mov-neg-firstpts-discard-frames \
fate-mov-stream-shorter-than-movie \
fate-mov-pcm-remux \
-# FIXME: Uncomment these two lines once the test files are uploaded to the fate
-# server.
-#   fate-mov-avif-demux-still-image-1-item \
-#   fate-mov-avif-demux-still-image-multiple-items \
+   fate-mov-avif-demux-still-image-1-item \
+   fate-mov-avif-demux-still-image-multiple-items \
 
 FATE_MOV_FFPROBE = fate-mov-neg-firstpts-discard \
fate-mov-neg-firstpts-discard-vorbis \
@@ -143,14 +141,12 @@ FATE_MOV_FFMPEG_FFPROBE-$(call TRANSCODE, TTML SUBRIP, 
MP4 MOV, SRT_DEMUXER TTML
 fate-mov-mp4-ttml-stpp: CMD = transcode srt 
$(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt mp4 "-map 0:s -c:s ttml 
-time_base:s 1:1000" "-map 0 -c copy" "-of json -show_entries 
packet:stream=index,codec_type,codec_tag_string,codec_tag,codec_name,time_base,start_time,duration_ts,duration,nb_frames,nb_read_packets:stream_tags"
 fate-mov-mp4-ttml-dfxp: CMD = transcode srt 
$(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt mp4 "-map 0:s -c:s ttml 
-time_base:s 1:1000 -tag:s dfxp -strict unofficial" "-map 0 -c copy" "-of json 
-show_entries 
packet:stream=index,codec_type,codec_tag_string,codec_tag,codec_name,time_base,start_time,duration_ts,duration,nb_frames,nb_read_packets:stream_tags"
 
-# FIXME: Uncomment these two tests once the test files are uploaded to the fate
-# server.
 # avif demuxing - still image with 1 item.
-#fate-mov-avif-demux-still-image-1-item: CMD = framemd5 -i 
$(TARGET_SAMPLES)/avif/still_image.avif -c:v copy
+fate-mov-avif-demux-still-image-1-item: CMD = framemd5 -i 
$(TARGET_SAMPLES)/avif/still_image.avif -c:v copy
 
 # avif demuxing - still image with multiple items. only the primary item will 
be
 # parsed.
-#fate-mov-avif-demux-still-image-multiple-items: CMD = framemd5 -i 
$(TARGET_SAMPLES)/avif/still_image_exif.avif -c:v copy
+fate-mov-avif-demux-still-image-multiple-items: CMD = framemd5 -i 
$(TARGET_SAMPLES)/avif/still_image_exif.avif -c:v copy
 
 # Resulting remux should have:
 # 1. first audio stream with AV_DISPOSITION_HEARING_IMPAIRED

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

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


[FFmpeg-cvslog] avformat/mov: Add support for demuxing still HEIC images

2024-01-09 Thread Vignesh Venkatasubramanian via ffmpeg-devel
ffmpeg | branch: master | Vignesh Venkatasubramanian via ffmpeg-devel 
 | Wed Oct  4 09:40:15 2023 -0700| 
[a0821345eb31b727d93c9c3ed7d74d2774c73afa] | committer: James Almer

avformat/mov: Add support for demuxing still HEIC images

They are similar to AVIF images (both use the HEIF container).
The only additional work needed is to parse the hvcC box and put
it in the extradata.

With this patch applied, ffmpeg (when built with an HEVC decoder)
is able to decode the files in
https://github.com/nokiatech/heif/tree/gh-pages/content/images

Also add a couple of fate tests with samples from
https://github.com/nokiatech/heif_conformance/tree/master/conformance_files

Partially fixes trac ticket #6521.

Signed-off-by: Vignesh Venkatasubramanian 
Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a0821345eb31b727d93c9c3ed7d74d2774c73afa
---

 libavformat/isom.h |  2 +
 libavformat/mov.c  | 43 +-
 tests/fate/mov.mak |  6 +++
 tests/ref/fate/mov-heic-demux-still-image-1-item   | 11 ++
 .../fate/mov-heic-demux-still-image-multiple-items | 11 ++
 5 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 3d375d7a46..b30b9da65e 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -327,6 +327,8 @@ typedef struct MOVContext {
 int64_t extent_offset;
 } *avif_info;
 int avif_info_size;
+int64_t hvcC_offset;
+int hvcC_size;
 int interleaved_read;
 } MOVContext;
 
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 72050a96a7..c6398d6d81 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1233,7 +1233,8 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 c->isom = 1;
 av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char 
*)&type);
 av_dict_set(&c->fc->metadata, "major_brand", type, 0);
-c->is_still_picture_avif = !strncmp(type, "avif", 4);
+c->is_still_picture_avif = !strncmp(type, "avif", 4) ||
+   !strncmp(type, "mif1", 4);
 minor_ver = avio_rb32(pb); /* minor version */
 av_dict_set_int(&c->fc->metadata, "minor_version", minor_ver, 0);
 
@@ -4940,6 +4941,19 @@ static int avif_add_stream(MOVContext *c, int item_id)
 st->priv_data = sc;
 st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
 st->codecpar->codec_id = AV_CODEC_ID_AV1;
+if (c->hvcC_offset >= 0) {
+int ret;
+int64_t pos = avio_tell(c->fc->pb);
+st->codecpar->codec_id = AV_CODEC_ID_HEVC;
+if (avio_seek(c->fc->pb, c->hvcC_offset, SEEK_SET) != c->hvcC_offset) {
+av_log(c->fc, AV_LOG_ERROR, "Failed to seek to hvcC data.\n");
+return AVERROR_UNKNOWN;
+}
+ret = ff_get_extradata(c->fc, st->codecpar, c->fc->pb, c->hvcC_size);
+if (ret < 0)
+return ret;
+avio_seek(c->fc->pb, pos, SEEK_SET);
+}
 sc->ffindex = st->index;
 c->trak_index = st->index;
 st->avg_frame_rate.num = st->avg_frame_rate.den = 1;
@@ -4982,6 +4996,8 @@ static int avif_add_stream(MOVContext *c, int item_id)
 
 static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
+c->hvcC_offset = -1;
+c->hvcC_size = 0;
 while (atom.size > 8) {
 uint32_t tag;
 if (avio_feof(pb))
@@ -7859,6 +7875,28 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return atom.size;
 }
 
+static int mov_read_iprp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+int size = avio_rb32(pb);
+if (avio_rl32(pb) != MKTAG('i','p','c','o'))
+return AVERROR_INVALIDDATA;
+size -= 8;
+while (size > 0) {
+int sub_size, sub_type;
+sub_size = avio_rb32(pb);
+sub_type = avio_rl32(pb);
+sub_size -= 8;
+size -= sub_size + 8;
+if (sub_type == MKTAG('h','v','c','C')) {
+c->hvcC_offset = avio_tell(pb);
+c->hvcC_size = sub_size;
+break;
+}
+avio_skip(pb, sub_size);
+}
+return atom.size;
+}
+
 static const MOVParseTableEntry mov_default_parse_table[] = {
 { MKTAG('A','C','L','R'), mov_read_aclr },
 { MKTAG('A','P','R','G'), mov_read_avid },
@@ -7966,6 +8004,7 @@ static const MOVParseTableEntry mov_default_parse_table[] 
= {
 { MKTAG('p','c','m','C'), mov_read_pcmc }, /* PCM configuration box */
 { MKTAG('p','i','t','m'), mov_read_pitm },
 { MKTAG('e','v','c','C'), mov_read_glbl },
+{ MKTAG('i','p','r','p'), mov_read_iprp },
 { 0, NULL }
 };
 
@@ -9335,7 +9374,7 @@ const AVInputFormat ff_mov_demuxer = {
 .long_name  = NULL_IF_CONFIG_SMALL("QuickTime / MOV"),
 .priv_class = &mov_class,
 .priv_data_size = sizeof(MOVContext),
-.extensions = "mov,mp4,m4a,3gp,3g2,mj2,psp,m4b,ism,ismv,isma,f4v,avif",
+.extensions = 
"mov,mp4,m4a,3gp,3g2,mj2,ps

[FFmpeg-cvslog] fate/mov: force the native av1 decoder for the avif tests

2024-01-09 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Jan  9 20:44:21 
2024 -0300| [6d2f64534dabd822da3d0b86b8df96f2a2cb537a] | committer: James Almer

fate/mov: force the native av1 decoder for the avif tests

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6d2f64534dabd822da3d0b86b8df96f2a2cb537a
---

 tests/fate/mov.mak   | 4 ++--
 tests/ref/fate/mov-avif-demux-still-image-1-item | 2 +-
 tests/ref/fate/mov-avif-demux-still-image-multiple-items | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 97f46f99ad..af1ac38c4d 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -144,11 +144,11 @@ fate-mov-mp4-ttml-stpp: CMD = transcode srt 
$(TARGET_SAMPLES)/sub/SubRip_capabil
 fate-mov-mp4-ttml-dfxp: CMD = transcode srt 
$(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt mp4 "-map 0:s -c:s ttml 
-time_base:s 1:1000 -tag:s dfxp -strict unofficial" "-map 0 -c copy" "-of json 
-show_entries 
packet:stream=index,codec_type,codec_tag_string,codec_tag,codec_name,time_base,start_time,duration_ts,duration,nb_frames,nb_read_packets:stream_tags"
 
 # avif demuxing - still image with 1 item.
-fate-mov-avif-demux-still-image-1-item: CMD = framemd5 -i 
$(TARGET_SAMPLES)/avif/still_image.avif -c:v copy
+fate-mov-avif-demux-still-image-1-item: CMD = framemd5 -c:v av1 -i 
$(TARGET_SAMPLES)/avif/still_image.avif -c:v copy
 
 # avif demuxing - still image with multiple items. only the primary item will 
be
 # parsed.
-fate-mov-avif-demux-still-image-multiple-items: CMD = framemd5 -i 
$(TARGET_SAMPLES)/avif/still_image_exif.avif -c:v copy
+fate-mov-avif-demux-still-image-multiple-items: CMD = framemd5 -c:v av1 -i 
$(TARGET_SAMPLES)/avif/still_image_exif.avif -c:v copy
 
 fate-mov-heic-demux-still-image-1-item: CMD = framemd5 -i 
$(TARGET_SAMPLES)/heif-conformance/C002.heic -c:v copy
 
diff --git a/tests/ref/fate/mov-avif-demux-still-image-1-item 
b/tests/ref/fate/mov-avif-demux-still-image-1-item
index 93773afd4e..b74a2d9dbc 100644
--- a/tests/ref/fate/mov-avif-demux-still-image-1-item
+++ b/tests/ref/fate/mov-avif-demux-still-image-1-item
@@ -6,6 +6,6 @@
 #media_type 0: video
 #codec_id 0: av1
 #dimensions 0: 352x288
-#sar 0: 1/1
+#sar 0: 0/1
 #stream#, dts,pts, duration, size, hash
 0,  0,  0,1,36265, 235b0c6e389c4084845981e08d60db04
diff --git a/tests/ref/fate/mov-avif-demux-still-image-multiple-items 
b/tests/ref/fate/mov-avif-demux-still-image-multiple-items
index 93773afd4e..b74a2d9dbc 100644
--- a/tests/ref/fate/mov-avif-demux-still-image-multiple-items
+++ b/tests/ref/fate/mov-avif-demux-still-image-multiple-items
@@ -6,6 +6,6 @@
 #media_type 0: video
 #codec_id 0: av1
 #dimensions 0: 352x288
-#sar 0: 1/1
+#sar 0: 0/1
 #stream#, dts,pts, duration, size, hash
 0,  0,  0,1,36265, 235b0c6e389c4084845981e08d60db04

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

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