Complements 76eb3e5ff3a35eff01dd71aca82efcda50c4441f.
Unified · Split
| @@ -284,6 +284,8 @@ typedef struct HEIFItem { · 283 unmodified lines | |||
| 284 | int width; | 284 | int width; |
| 285 | int height; | 285 | int height; |
| 286 | int rotation; | 286 | int rotation; |
| 287 | int hflip; | ||
| 288 | int vflip; | ||
| 287 | int type; | 289 | int type; |
| 288 | int is_idat_relative; | 290 | int is_idat_relative; |
| 289 | uint8_t *icc_profile; | 291 | uint8_t *icc_profile; |
| @@ -8994,6 +8994,25 @@ static int mov_read_irot(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 8993 unmodified lines | |||
| 8994 | return 0; | 8994 | return 0; |
| 8995 | } | 8995 | } |
| 8996 | 8996 | ||
| 8997 | static int mov_read_imir(MOVContext *c, AVIOContext *pb, MOVAtom atom) | ||
| 8998 | { | ||
| 8999 | HEIFItem *item; | ||
| 9000 | int axis; | ||
| 9001 | |||
| 9002 | axis = avio_r8(pb) & 0x1; | ||
| 9003 | |||
| 9004 | av_log(c->fc, AV_LOG_TRACE, "imir: item_id %d, axis %u\n", | ||
| 9005 | c->cur_item_id, axis); | ||
| 9006 | |||
| 9007 | item = heif_cur_item(c); | ||
| 9008 | if (item) { | ||
| 9009 | item->hflip = axis; | ||
| 9010 | item->vflip = !axis; | ||
| 9011 | } | ||
| 9012 | |||
| 9013 | return 0; | ||
| 9014 | } | ||
| 9015 | |||
| 8997 | static int mov_read_iprp(MOVContext *c, AVIOContext *pb, MOVAtom atom) | 9016 | static int mov_read_iprp(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 8998 | { | 9017 | { |
| 8999 | typedef struct MOVAtoms { | 9018 | typedef struct MOVAtoms { |
| @@ -9218,6 +9237,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { · 218 unmodified lines | |||
| 9218 | { MKTAG('p','i','t','m'), mov_read_pitm }, | 9237 | { MKTAG('p','i','t','m'), mov_read_pitm }, |
| 9219 | { MKTAG('e','v','c','C'), mov_read_glbl }, | 9238 | { MKTAG('e','v','c','C'), mov_read_glbl }, |
| 9220 | { MKTAG('i','d','a','t'), mov_read_idat }, | 9239 | { MKTAG('i','d','a','t'), mov_read_idat }, |
| 9240 | { MKTAG('i','m','i','r'), mov_read_imir }, | ||
| 9221 | { MKTAG('i','r','e','f'), mov_read_iref }, | 9241 | { MKTAG('i','r','e','f'), mov_read_iref }, |
| 9222 | { MKTAG('i','s','p','e'), mov_read_ispe }, | 9242 | { MKTAG('i','s','p','e'), mov_read_ispe }, |
| 9223 | { MKTAG('i','r','o','t'), mov_read_irot }, | 9243 | { MKTAG('i','r','o','t'), mov_read_irot }, |
| @@ -9922,6 +9942,7 @@ static int set_display_matrix_from_item(AVPacketSideData **coded_side_data, int · 698 unmodified lines | |||
| 9922 | * av_display_rotation_set() expects its argument to be | 9942 | * av_display_rotation_set() expects its argument to be |
| 9923 | * oriented clockwise, so we need to negate it. */ | 9943 | * oriented clockwise, so we need to negate it. */ |
| 9924 | av_display_rotation_set(matrix, -item->rotation); | 9944 | av_display_rotation_set(matrix, -item->rotation); |
| 9945 | av_display_matrix_flip(matrix, item->hflip, item->vflip); | ||
| 9925 | 9946 | ||
| 9926 | return 0; | 9947 | return 0; |
| 9927 | } | 9948 | } |
| @@ -9967,7 +9988,7 @@ static int read_image_grid(AVFormatContext *s, const HEIFGrid *grid, · 39 unmodified lines | |||
| 9967 | return ret; | 9988 | return ret; |
| 9968 | } | 9989 | } |
| 9969 | /* rotation */ | 9990 | /* rotation */ |
| 9970 | if (item->rotation) { | 9991 | if (item->rotation || item->hflip || item->vflip) { |
| 9971 | int ret = set_display_matrix_from_item(&tile_grid->coded_side_data, | 9992 | int ret = set_display_matrix_from_item(&tile_grid->coded_side_data, |
| 9972 | &tile_grid->nb_coded_side_data, item); | 9993 | &tile_grid->nb_coded_side_data, item); |
| 9973 | if (ret < 0) | 9994 | if (ret < 0) |
| @@ -10066,7 +10087,7 @@ static int read_image_iovl(AVFormatContext *s, const HEIFGrid *grid, · 92 unmodified lines | |||
| 10066 | tile_grid->coded_height = (flags & 1) ? avio_rb32(s->pb) : avio_rb16(s->pb); | 10087 | tile_grid->coded_height = (flags & 1) ? avio_rb32(s->pb) : avio_rb16(s->pb); |
| 10067 | 10088 | ||
| 10068 | /* rotation */ | 10089 | /* rotation */ |
| 10069 | if (item->rotation) { | 10090 | if (item->rotation || item->hflip || item->vflip) { |
| 10070 | int ret = set_display_matrix_from_item(&tile_grid->coded_side_data, | 10091 | int ret = set_display_matrix_from_item(&tile_grid->coded_side_data, |
| 10071 | &tile_grid->nb_coded_side_data, item); | 10092 | &tile_grid->nb_coded_side_data, item); |
| 10072 | if (ret < 0) | 10093 | if (ret < 0) |
| @@ -10283,7 +10304,7 @@ static int mov_read_header(AVFormatContext *s) · 210 unmodified lines | |||
| 10283 | if (item->item_id == mov->primary_item_id) | 10304 | if (item->item_id == mov->primary_item_id) |
| 10284 | st->disposition |= AV_DISPOSITION_DEFAULT; | 10305 | st->disposition |= AV_DISPOSITION_DEFAULT; |
| 10285 | 10306 | ||
| 10286 | if (item->rotation) { | 10307 | if (item->rotation || item->hflip || item->vflip) { |
| 10287 | int ret = set_display_matrix_from_item(&st->codecpar->coded_side_data, | 10308 | int ret = set_display_matrix_from_item(&st->codecpar->coded_side_data, |
| 10288 | &st->codecpar->nb_coded_side_data, item); | 10309 | &st->codecpar->nb_coded_side_data, item); |
| 10289 | if (ret < 0) | 10310 | if (ret < 0) |