--- branches/dev-api-4/xvidcore/examples/xvid_encraw.c 2003/08/09 17:19:20 1119 +++ branches/dev-api-4/xvidcore/examples/xvid_encraw.c 2003/11/30 17:11:01 1231 @@ -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.34 2003-08-09 17:19:20 edgomez Exp $ + * $Id: xvid_encraw.c,v 1.11.2.37 2003-11-30 17:11:01 chl Exp $ * ****************************************************************************/ @@ -152,6 +152,7 @@ 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) @@ -343,6 +344,8 @@ 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); @@ -691,6 +694,7 @@ 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"); @@ -918,6 +922,7 @@ /* Width and Height of input frames */ xvid_enc_create.width = XDIM; xvid_enc_create.height = YDIM; + xvid_enc_create.profile = XVID_PROFILE_AS_L4; /* init plugins */ xvid_enc_create.zones = ZONES; @@ -1008,10 +1013,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); @@ -1083,10 +1091,6 @@ /* Set up core's general features */ xvid_enc_frame.vop_flags = vop_presets[ARG_QUALITY]; - if (ARG_QPEL && (xvid_enc_frame.vop_flags & XVID_ME_HALFPELREFINE16)) - xvid_enc_frame.vop_flags |= XVID_ME_QUARTERPELREFINE16; - if (ARG_QPEL && (xvid_enc_frame.vop_flags & XVID_ME_HALFPELREFINE8)) - xvid_enc_frame.vop_flags |= XVID_ME_QUARTERPELREFINE8; if (ARG_GMC) xvid_enc_frame.vop_flags |= XVID_ME_GME_REFINE; @@ -1103,6 +1107,11 @@ /* 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;