From 6a27a481d4c3508ce778a61a139a4734bb8126f7 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Fri, 24 Feb 2012 13:16:52 -0800 Subject: [PATCH] Add full-recon API option Fully reconstruct frames even without dump-yuv. --- encoder/encoder.c | 8 ++++++-- x264.h | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/encoder/encoder.c b/encoder/encoder.c index a2023e91..2a55b76b 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -921,6 +921,9 @@ static int x264_validate_parameters( x264_t *h, int b_open ) h->param.i_nal_hrd = X264_NAL_HRD_VBR; } + if( h->param.psz_dump_yuv ) + h->param.b_full_recon = 1; + /* ensure the booleans are 0 or 1 so they can be used in math */ #define BOOLIFY(x) h->param.x = !!h->param.x BOOLIFY( b_cabac ); @@ -941,6 +944,7 @@ static int x264_validate_parameters( x264_t *h, int b_open ) BOOLIFY( b_fake_interlaced ); BOOLIFY( b_open_gop ); BOOLIFY( b_bluray_compat ); + BOOLIFY( b_full_recon ); BOOLIFY( analyse.b_transform_8x8 ); BOOLIFY( analyse.b_weighted_bipred ); BOOLIFY( analyse.b_chroma_me ); @@ -1839,7 +1843,7 @@ static void x264_fdec_filter_row( x264_t *h, int mb_y, int b_inloop ) * above each MB, as bS=4 doesn't happen for the top of interlaced mbpairs. */ int minpix_y = min_y*16 - 4 * !b_start; int maxpix_y = mb_y*16 - 4 * !b_end; - b_deblock &= b_hpel || h->param.psz_dump_yuv; + b_deblock &= b_hpel || h->param.b_full_recon; if( h->param.b_sliced_threads && b_start && min_y && !b_inloop ) { b_deblock = 0; /* We already deblocked on the inloop pass. */ @@ -2144,7 +2148,7 @@ static int x264_slice_write( x264_t *h ) int orig_last_mb = h->sh.i_last_mb; uint8_t *last_emu_check; x264_bs_bak_t bs_bak[2]; - b_deblock &= b_hpel || h->param.psz_dump_yuv; + b_deblock &= b_hpel || h->param.b_full_recon; bs_realign( &h->out.bs ); /* Slice */ diff --git a/x264.h b/x264.h index 2a34d013..efc61bc0 100644 --- a/x264.h +++ b/x264.h @@ -41,7 +41,7 @@ #include "x264_config.h" -#define X264_BUILD 121 +#define X264_BUILD 122 /* x264_t: * opaque handler for encoder */ @@ -323,6 +323,7 @@ typedef struct x264_param_t void *p_log_private; int i_log_level; int b_visualize; + int b_full_recon; /* fully reconstruct frames, even when not necessary for encoding. Implied by psz_dump_yuv */ char *psz_dump_yuv; /* filename for reconstructed frames */ /* Encoder analyser parameters */ @@ -727,7 +728,10 @@ typedef struct of H.264 itself; in this case, the caller must force an IDR frame if it needs the changed parameter to apply immediately. */ x264_param_t *param; - /* In: raw data */ + /* In: raw image data */ + /* Out: reconstructed image data. x264 may skip part of the reconstruction process, + e.g. deblocking, in frames where it isn't necessary. To force complete + reconstruction, at a small speed cost, set b_full_recon. */ x264_image_t img; /* In: optional information to modify encoder decisions for this frame * Out: information about the encoded frame */ -- 2.47.3