--- xvid_encraw.c 2003/08/02 15:07:59 1.11.2.30 +++ xvid_encraw.c 2003/10/27 00:48:29 1.11.2.36 @@ -21,7 +21,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: xvid_encraw.c,v 1.11.2.30 2003/08/02 15:07:59 edgomez Exp $ + * $Id: xvid_encraw.c,v 1.11.2.36 2003/10/27 00:48:29 edgomez Exp $ * ****************************************************************************/ @@ -150,6 +150,9 @@ static int ARG_PACKED = 0; static int ARG_DEBUG = 0; static int ARG_VOPDEBUG = 0; +static int ARG_GMC = 0; +static int ARG_QPEL = 0; +static int ARG_CLOSED_GOP = 0; #ifndef READ_PNM #define IMAGE_SIZE(x,y) ((x)*(y)*3/2) @@ -337,6 +340,12 @@ ARG_OUTPUTFILE = argv[i]; } else if (strcmp("-vop_debug", argv[i]) == 0) { ARG_VOPDEBUG = 1; + } else if (strcmp("-qpel", argv[i]) == 0) { + ARG_QPEL = 1; + } else if (strcmp("-gmc", argv[i]) == 0) { + ARG_GMC = 1; + } else if (strcmp("-closed_gop", argv[i]) == 0) { + ARG_CLOSED_GOP = 1; } else if (strcmp("-help", argv[i])) { usage(); return (0); @@ -682,7 +691,10 @@ fprintf(stderr, "Other options\n"); fprintf(stderr, " -asm : use assembly optmized code\n"); fprintf(stderr, " -quality integer: quality ([0..%d])\n", ME_ELEMENTS - 1); + fprintf(stderr, " -qpel : use quarter pixel ME\n"); + fprintf(stderr, " -gmc : use global motion compensation\n"); fprintf(stderr, " -packed : packed mode\n"); + fprintf(stderr, " -closed_gop : closed GOP mode\n"); fprintf(stderr, " -lumimasking : use lumimasking algorithm\n"); fprintf(stderr, " -stats : print stats about encoded frames\n"); fprintf(stderr, " -debug : activates xvidcore internal debugging output\n"); @@ -1000,10 +1012,13 @@ xvid_enc_create.global = 0; if (ARG_PACKED) - xvid_enc_create.global |=XVID_GLOBAL_PACKED; + xvid_enc_create.global |= XVID_GLOBAL_PACKED; + + if (ARG_CLOSED_GOP) + xvid_enc_create.global |= XVID_GLOBAL_CLOSED_GOP; if (ARG_STATS) - xvid_enc_create.global |=XVID_GLOBAL_EXTRASTATS_ENABLE; + xvid_enc_create.global |= XVID_GLOBAL_EXTRASTATS_ENABLE; /* I use a small value here, since will not encode whole movies, but short clips */ xerr = xvid_encore(NULL, XVID_ENC_CREATE, &xvid_enc_create, NULL); @@ -1068,9 +1083,16 @@ xvid_enc_frame.vol_flags = 0; if (ARG_STATS) xvid_enc_frame.vol_flags |= XVID_VOL_EXTRASTATS; + if (ARG_QPEL) + xvid_enc_frame.vol_flags |= XVID_VOL_QUARTERPEL; + if (ARG_GMC) + xvid_enc_frame.vol_flags |= XVID_VOL_GMC; /* Set up core's general features */ xvid_enc_frame.vop_flags = vop_presets[ARG_QUALITY]; + if (ARG_GMC) + xvid_enc_frame.vop_flags |= XVID_ME_GME_REFINE; + if (ARG_VOPDEBUG) { xvid_enc_frame.vop_flags |= XVID_VOP_DEBUG; } @@ -1084,14 +1106,18 @@ /* Set up motion estimation flags */ xvid_enc_frame.motion = motion_presets[ARG_QUALITY]; + if (ARG_QPEL) + xvid_enc_frame.motion |= XVID_ME_QUARTERPELREFINE16; + if (ARG_QPEL && (xvid_enc_frame.vop_flags & XVID_VOP_INTER4V)) + xvid_enc_frame.motion |= XVID_ME_QUARTERPELREFINE8; + /* We don't use special matrices */ xvid_enc_frame.quant_intra_matrix = NULL; xvid_enc_frame.quant_inter_matrix = NULL; /* Encode the frame */ - ret = - xvid_encore(enc_handle, XVID_ENC_ENCODE, &xvid_enc_frame, - &xvid_enc_stats); + ret = xvid_encore(enc_handle, XVID_ENC_ENCODE, &xvid_enc_frame, + &xvid_enc_stats); *key = (xvid_enc_frame.out_flags & XVID_KEYFRAME); *stats_type = xvid_enc_stats.type;