demux_mkv: PAR should be calculated after applying crop

DisplayWidth/DisplayHeight applies to the video frame after cropping (PixelCrop* Elements).
This commit is contained in:
Kacper Michajłow 2023-10-20 04:10:19 +02:00 committed by Dudemanguy
parent 5705d819ab
commit f8db02b59d
1 changed files with 10 additions and 10 deletions

View File

@ -1510,16 +1510,6 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track)
sh_v->disp_w = track->v_width;
sh_v->disp_h = track->v_height;
int dw = track->v_dwidth_set ? track->v_dwidth : track->v_width;
int dh = track->v_dheight_set ? track->v_dheight : track->v_height;
struct mp_image_params p = {.w = track->v_width, .h = track->v_height};
mp_image_params_set_dsize(&p, dw, dh);
sh_v->par_w = p.p_w;
sh_v->par_h = p.p_h;
sh_v->stereo_mode = track->stereo_mode;
sh_v->color = track->color;
sh_v->crop.x0 = track->v_crop_left_set ? track->v_crop_left : 0;
sh_v->crop.y0 = track->v_crop_top_set ? track->v_crop_top : 0;
sh_v->crop.x1 = track->v_width -
@ -1527,6 +1517,16 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track)
sh_v->crop.y1 = track->v_height -
(track->v_crop_bottom_set ? track->v_crop_bottom : 0);
int dw = track->v_dwidth_set ? track->v_dwidth : mp_rect_w(sh_v->crop);
int dh = track->v_dheight_set ? track->v_dheight : mp_rect_h(sh_v->crop);
struct mp_image_params p = {.w = mp_rect_w(sh_v->crop), .h = mp_rect_h(sh_v->crop)};
mp_image_params_set_dsize(&p, dw, dh);
sh_v->par_w = p.p_w;
sh_v->par_h = p.p_h;
sh_v->stereo_mode = track->stereo_mode;
sh_v->color = track->color;
if (track->v_projection_pose_roll_set) {
int rotate = lrintf(fmodf(fmodf(track->v_projection_pose_roll, 360) + 360, 360));
sh_v->rotate = rotate;