]> granicus.if.org Git - libx264/commitdiff
Fix --crop-rect top offset with --interlaced or --fake-interlaced
authorAnton Mitrofanov <BugMaster@narod.ru>
Wed, 10 Oct 2018 16:41:08 +0000 (19:41 +0300)
committerHenrik Gramner <henrik@gramner.com>
Sun, 23 Dec 2018 19:13:43 +0000 (20:13 +0100)
Bug report by Koby Shina.

encoder/encoder.c
encoder/set.c

index 074c4a5c2ba8f0a9df3778d2f1d593b22e09fa20..785d6ed252da6fccc817168f8dff5737be23adc2 100644 (file)
@@ -508,7 +508,7 @@ static int validate_parameters( x264_t *h, int b_open )
     }
 
     int w_mod = 1;
-    int h_mod = 1 << PARAM_INTERLACED;
+    int h_mod = 1 << (PARAM_INTERLACED || h->param.b_fake_interlaced);
     if( i_csp == X264_CSP_I400 )
     {
         h->param.analyse.i_chroma_qp_offset = 0;
index 07a1261e180d001feb26b12d9179c7734ee979e6..6cfda793eed4458784b421761c2041f859dd7548 100644 (file)
@@ -250,7 +250,7 @@ void x264_sps_init_reconfigurable( x264_sps_t *sps, x264_param_t *param )
     sps->crop.i_left   = param->crop_rect.i_left;
     sps->crop.i_top    = param->crop_rect.i_top;
     sps->crop.i_right  = param->crop_rect.i_right + sps->i_mb_width*16 - param->i_width;
-    sps->crop.i_bottom = (param->crop_rect.i_bottom + sps->i_mb_height*16 - param->i_height) >> !sps->b_frame_mbs_only;
+    sps->crop.i_bottom = param->crop_rect.i_bottom + sps->i_mb_height*16 - param->i_height;
     sps->b_crop = sps->crop.i_left  || sps->crop.i_top ||
                   sps->crop.i_right || sps->crop.i_bottom;
 
@@ -363,7 +363,7 @@ void x264_sps_write( bs_t *s, x264_sps_t *sps )
     if( sps->b_crop )
     {
         int h_shift = sps->i_chroma_format_idc == CHROMA_420 || sps->i_chroma_format_idc == CHROMA_422;
-        int v_shift = sps->i_chroma_format_idc == CHROMA_420;
+        int v_shift = (sps->i_chroma_format_idc == CHROMA_420) + !sps->b_frame_mbs_only;
         bs_write_ue( s, sps->crop.i_left   >> h_shift );
         bs_write_ue( s, sps->crop.i_right  >> h_shift );
         bs_write_ue( s, sps->crop.i_top    >> v_shift );