[Drdivx-commits] SF.net SVN: drdivx: [202] DrDivX/trunk/drdivx2
Brought to you by:
harikrishnan_v,
seabass089
From: <ro...@us...> - 2006-07-06 18:30:38
|
Revision: 202 Author: robUx4 Date: 2006-07-06 11:30:13 -0700 (Thu, 06 Jul 2006) ViewCVS: http://svn.sourceforge.net/drdivx/?rev=202&view=rev Log Message: ----------- Use the resizing (bilinear) and cropping from the DivX codec instead of FFMPEG (better quality and speed) Modified Paths: -------------- DrDivX/trunk/drdivx2/Changelog DrDivX/trunk/drdivx2/src/encoder/AudioTrackEncoder.cpp DrDivX/trunk/drdivx2/src/encoder/PortableTrackEncoder.cpp DrDivX/trunk/drdivx2/src/encoder/VideoTrackEncoder.cpp DrDivX/trunk/drffmpeg/export/drffmpeg/avcodec.h DrDivX/trunk/drffmpeg/libavcodec/divx.c Modified: DrDivX/trunk/drdivx2/Changelog =================================================================== --- DrDivX/trunk/drdivx2/Changelog 2006-07-06 01:55:30 UTC (rev 201) +++ DrDivX/trunk/drdivx2/Changelog 2006-07-06 18:30:13 UTC (rev 202) @@ -17,6 +17,7 @@ fix clipping audio when the channel mapping is guessed (AAC via RealMediaSplitter.ax) support MBAFF in H264 add support for Flash Screen Video codec +Use the resizing (bilinear) and cropping from the DivX codec instead of FFMPEG (better quality and speed) * version 2.0.0 RC2 (27th June 2006) Modified: DrDivX/trunk/drdivx2/src/encoder/AudioTrackEncoder.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/encoder/AudioTrackEncoder.cpp 2006-07-06 01:55:30 UTC (rev 201) +++ DrDivX/trunk/drdivx2/src/encoder/AudioTrackEncoder.cpp 2006-07-06 18:30:13 UTC (rev 202) @@ -49,7 +49,7 @@ #include "TrackEncoderImpl.h" #include "AudioTrackEncoder.h" #include "PropertyHelper.h" -#include "MP3Encoder.h" +#include "Mp3Encoder.h" int opt_input_file(const char *); int opt_output_file(const char *); Modified: DrDivX/trunk/drdivx2/src/encoder/PortableTrackEncoder.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/encoder/PortableTrackEncoder.cpp 2006-07-06 01:55:30 UTC (rev 201) +++ DrDivX/trunk/drdivx2/src/encoder/PortableTrackEncoder.cpp 2006-07-06 18:30:13 UTC (rev 202) @@ -162,6 +162,7 @@ int b_frames = 0; int pre_me = 0; int do_deinterlace = 0; +int do_resizing = 1; int workaround_bugs = FF_BUG_AUTODETECT; int packet_size = 0; int error_rate = 0; @@ -1749,7 +1750,15 @@ ost->encoding_needed = 1; break; case CODEC_TYPE_VIDEO: - if (codec->width == icodec->width && + ost->st->codec->in_width = codec->width; + ost->st->codec->in_height = codec->height; + if (do_resizing == 0) { + ost->video_resample = 0; + ost->video_crop = 0; + ost->video_pad = 0; + ost->st->codec->in_width = icodec->width; + ost->st->codec->in_height = icodec->height; + } else if (codec->width == icodec->width && codec->height == icodec->height && frame_topBand == 0 && frame_bottomBand == 0 && @@ -3192,6 +3201,7 @@ b_frames = 0; pre_me = 0; do_deinterlace = 0; + do_resizing = 1; workaround_bugs = FF_BUG_AUTODETECT; packet_size = 0; error_rate = 0; Modified: DrDivX/trunk/drdivx2/src/encoder/VideoTrackEncoder.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/encoder/VideoTrackEncoder.cpp 2006-07-06 01:55:30 UTC (rev 201) +++ DrDivX/trunk/drdivx2/src/encoder/VideoTrackEncoder.cpp 2006-07-06 18:30:13 UTC (rev 202) @@ -73,6 +73,7 @@ extern int video_bit_rate; extern int do_deinterlace; +extern int do_resizing; extern int nb_input_files; extern int nb_output_files; @@ -207,25 +208,15 @@ return vidEncConfigErr; } + do_resizing = 0; + bool enableResizing = (GetUInt32PropertyValue(profile, VIDEO_ENC_RESIZE_MODE_PROP) == NoResize) ? false : true; uint32_t resized_width = GetUInt32PropertyValue(profile, VIDEO_ENC_RESIZE_WIDTH_PROP); uint32_t resized_height = GetUInt32PropertyValue(profile, VIDEO_ENC_RESIZE_HEIGHT_PROP); - if (enableResizing || resized_width != frame_width || resized_height != frame_height) - { - frame_width = resized_width; - frame_height = resized_height; - - bool enableCropping = (GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_MODE_PROP) == NoCrop) ? false : true; - if (enableResizing && enableCropping) - { - frame_topBand = GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_TOP_PROP); - frame_leftBand = GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_LEFT_PROP); - frame_bottomBand = GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_BOTTOM_PROP); - frame_rightBand = GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_RIGHT_PROP); - } - } - + // Generate command-line + string cmdline; + char tmp[255]; // Set the bitrate when bitrate control mode is not constant quality video_bit_rate = GetUInt32PropertyValue(profile, VIDEO_ENC_BITRATE_PROP) * 1000; @@ -243,12 +234,9 @@ assert(prop != NULL); frame_rate = PropertyHelper::GetUInt32Value(prop); - // Generate command-line - string cmdline; bool multiPass = false; uint32_t value = 0; double dblValue = 0.0; - char tmp[255]; switch (GetUInt32PropertyValue(profile, VIDEO_ENC_RATE_CONTROL_MODE_PROP)) { @@ -310,6 +298,37 @@ cmdline += "-profile=4 "; }; + if (enableResizing || resized_width != frame_width || resized_height != frame_height) + { + + bool enableCropping = (GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_MODE_PROP) != NoCrop); + if (enableResizing && enableCropping) + { + cmdline += "-c "; + _snprintf(tmp, 255, "%d,%d,%d,%d ", + GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_LEFT_PROP), + GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_RIGHT_PROP), + GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_TOP_PROP), + GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_BOTTOM_PROP)); + cmdline += string(tmp); + } + + cmdline += "-r "; + _snprintf(tmp, 255, "%d,%d,1 ", resized_width, resized_height); // 1 for bilinear + cmdline += string(tmp); + + frame_width = resized_width; + frame_height = resized_height; + + if (enableResizing && enableCropping) + { + frame_topBand = GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_TOP_PROP); + frame_leftBand = GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_LEFT_PROP); + frame_bottomBand = GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_BOTTOM_PROP); + frame_rightBand = GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_RIGHT_PROP); + } + } + prop = NULL; GetProperty(JOB_TMP_FOLDER_PATH_PROP, &prop); assert(prop != NULL); Modified: DrDivX/trunk/drffmpeg/export/drffmpeg/avcodec.h =================================================================== --- DrDivX/trunk/drffmpeg/export/drffmpeg/avcodec.h 2006-07-06 01:55:30 UTC (rev 201) +++ DrDivX/trunk/drffmpeg/export/drffmpeg/avcodec.h 2006-07-06 18:30:13 UTC (rev 202) @@ -23,8 +23,8 @@ #define AV_STRINGIFY(s) AV_TOSTRING(s) #define AV_TOSTRING(s) #s -#define LIBAVCODEC_VERSION_INT ((51<<16)+(8<<8)+3) -#define LIBAVCODEC_VERSION 51.8.3 +#define LIBAVCODEC_VERSION_INT ((51<<16)+(8<<8)+4) +#define LIBAVCODEC_VERSION 51.8.4 #define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) @@ -2037,6 +2037,12 @@ * - decoding: set by mpeg video decoder */ int curr_pict_is_frame; + + /** DivX, Inc. + * used when doing the encoding internally + */ + int in_width; + int in_height; } AVCodecContext; Modified: DrDivX/trunk/drffmpeg/libavcodec/divx.c =================================================================== --- DrDivX/trunk/drffmpeg/libavcodec/divx.c 2006-07-06 01:55:30 UTC (rev 201) +++ DrDivX/trunk/drffmpeg/libavcodec/divx.c 2006-07-06 18:30:13 UTC (rev 202) @@ -163,8 +163,8 @@ memset(x->inputBmp, 0, sizeof(BITMAPINFO)); x->inputBmp->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - x->inputBmp->bmiHeader.biWidth = avctx->width; - x->inputBmp->bmiHeader.biHeight = avctx->height; + x->inputBmp->bmiHeader.biWidth = avctx->in_width; + x->inputBmp->bmiHeader.biHeight = avctx->in_height; x->inputBmp->bmiHeader.biPlanes = 1; x->inputBmp->bmiHeader.biBitCount = 0; x->inputBmp->bmiHeader.biCompression = mmioFOURCC('I','4','2','0'); @@ -236,10 +236,10 @@ x = avctx->priv_data; picture = data; - size = (avctx->width * avctx->height * 3) / 2; + size = (avctx->in_width * avctx->in_height * 3) / 2; picture_buf = av_malloc(size); - avpicture_layout(picture, PIX_FMT_YUV420P, avctx->width, avctx->height, + avpicture_layout(picture, PIX_FMT_YUV420P, avctx->in_width, avctx->in_height, picture_buf, size); iccompress.dwFlags = ICCOMPRESS_KEYFRAME; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |