Supposedly useful for 3D television applications.
p->rc.f_complexity_blur = atof(value);
OPT("zones")
p->rc.psz_zones = strdup(value);
+ OPT("crop-rect")
+ b_error |= sscanf( value, "%u,%u,%u,%u", &p->crop_rect.i_left, &p->crop_rect.i_top,
+ &p->crop_rect.i_right, &p->crop_rect.i_bottom ) != 4;
OPT("psnr")
p->analyse.b_psnr = atobool(value);
OPT("ssim")
return -1;
}
+ if( (h->param.crop_rect.i_left + h->param.crop_rect.i_right ) >= h->param.i_width ||
+ (h->param.crop_rect.i_top + h->param.crop_rect.i_bottom) >= h->param.i_height )
+ {
+ x264_log( h, X264_LOG_ERROR, "invalid crop-rect %u,%u,%u,%u\n", h->param.crop_rect.i_left,
+ h->param.crop_rect.i_top, h->param.crop_rect.i_right, h->param.crop_rect.i_bottom );
+ return -1;
+ }
+
if( h->param.i_threads == X264_THREADS_AUTO )
h->param.i_threads = x264_cpu_num_processors() * (h->param.b_sliced_threads?2:3)/2;
h->param.i_threads = x264_clip3( h->param.i_threads, 1, X264_THREAD_MAX );
COPY( analyse.b_mixed_references );
COPY( analyse.f_psy_rd );
COPY( analyse.f_psy_trellis );
+ COPY( crop_rect );
// can only twiddle these if they were enabled to begin with:
if( h->param.analyse.i_me_method >= X264_ME_ESA || param->analyse.i_me_method < X264_ME_ESA )
COPY( analyse.i_me_method );
sps->b_mb_adaptive_frame_field = param->b_interlaced;
sps->b_direct8x8_inference = 1;
- sps->crop.i_left = 0;
- sps->crop.i_top = 0;
- sps->crop.i_right = sps->i_mb_width*16 - param->i_width;
- sps->crop.i_bottom = (sps->i_mb_height*16 - param->i_height) >> !sps->b_frame_mbs_only;
+ 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->b_crop = sps->crop.i_left || sps->crop.i_top ||
sps->crop.i_right || sps->crop.i_bottom;
H2( " --nal-hrd <string> Signal HRD information (requires vbv-bufsize)\n"
" - none, vbr, cbr (cbr not allowed in .mp4)\n" );
H2( " --pic-struct Force pic_struct in Picture Timing SEI\n" );
+ H2( " --crop-rect <string> Add 'left,top,right,bottom' to the bitstream-level\n"
+ " cropping rectangle\n" );
H0( "\n" );
H0( "Input/Output:\n" );
{ "tcfile-out", required_argument, NULL, OPT_TCFILE_OUT },
{ "timebase", required_argument, NULL, OPT_TIMEBASE },
{ "pic-struct", no_argument, NULL, 0 },
+ { "crop-rect", required_argument, NULL, 0 },
{ "nal-hrd", required_argument, NULL, 0 },
{ "pulldown", required_argument, NULL, OPT_PULLDOWN },
{ "fake-interlaced", no_argument, NULL, 0 },
#include <stdarg.h>
-#define X264_BUILD 107
+#define X264_BUILD 108
/* x264_t:
* opaque handler for encoder */
char *psz_zones; /* alternate method of specifying zones */
} rc;
+ /* Cropping Rectangle parameters: added to those implicitly defined by
+ non-mod16 video resolutions. */
+ struct {
+ unsigned int i_left;
+ unsigned int i_top;
+ unsigned int i_right;
+ unsigned int i_bottom;
+ } crop_rect;
+
/* Muxing parameters */
int b_aud; /* generate access unit delimiters */
int b_repeat_headers; /* put SPS/PPS before each keyframe */