hevcdec: scale HDRPlus window coordinates
This commit is contained in:
parent
4b0faa3e77
commit
e7da7f1ba5
@ -29,6 +29,7 @@
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/film_grain_params.h"
|
||||
#include "libavutil/hdr_dynamic_metadata.h"
|
||||
#include "libavutil/internal.h"
|
||||
#include "libavutil/md5.h"
|
||||
#include "libavutil/mem.h"
|
||||
@ -2870,7 +2871,30 @@ static int set_side_data(HEVCContext *s)
|
||||
}
|
||||
|
||||
if (s->sei.common.dynamic_hdr_plus.info) {
|
||||
AVBufferRef *info_ref = av_buffer_ref(s->sei.common.dynamic_hdr_plus.info);
|
||||
AVBufferRef *info_ref;
|
||||
AVDynamicHDRPlus *metadata = (AVDynamicHDRPlus*)s->sei.common.dynamic_hdr_plus.info->data;
|
||||
|
||||
// fill in window 0 (full frame) and convert to relative coordinates
|
||||
if (metadata->params[0].window_lower_right_corner_x.num == 0)
|
||||
{
|
||||
// ensure the buffer is writable
|
||||
av_buffer_make_writable(&s->sei.common.dynamic_hdr_plus.info);
|
||||
metadata = (AVDynamicHDRPlus*)s->sei.common.dynamic_hdr_plus.info->data;
|
||||
|
||||
// Convert coordinates to relative coordinate in [0, 1].
|
||||
metadata->params[0].window_upper_left_corner_x.num = 0;
|
||||
metadata->params[0].window_upper_left_corner_y.num = 0;
|
||||
metadata->params[0].window_lower_right_corner_x.num = out->width - 1;
|
||||
metadata->params[0].window_lower_right_corner_y.num = out->height - 1;
|
||||
for (int w = 0; w < metadata->num_windows; w++) {
|
||||
metadata->params[w].window_upper_left_corner_x.den = out->width - 1;
|
||||
metadata->params[w].window_upper_left_corner_y.den = out->height - 1;
|
||||
metadata->params[w].window_lower_right_corner_x.den = out->width - 1;
|
||||
metadata->params[w].window_lower_right_corner_y.den = out->height - 1;
|
||||
}
|
||||
}
|
||||
|
||||
info_ref = av_buffer_ref(s->sei.common.dynamic_hdr_plus.info);
|
||||
if (!info_ref)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user