Ticket #2198: 1080iTranscode.20060821.patch
File 1080iTranscode.20060821.patch, 4.5 KB (added by , 17 years ago) |
---|
-
programs/mythtranscode/transcode.cpp
383 383 384 384 int video_width = nvp->GetVideoWidth(); 385 385 int video_height = nvp->GetVideoHeight(); 386 387 if (video_height == 1088) { 388 VERBOSE(VB_IMPORTANT, QString("Unlikely the video height really is 1088, using hacks...")); 389 } 390 386 391 float video_aspect = nvp->GetVideoAspect(); 387 392 float video_frame_rate = nvp->GetFrameRate(); 388 393 int newWidth = video_width; … … 415 420 } 416 421 else if (profile.byName("transcoderesize")->getValue().toInt()) 417 422 { 423 int fudge1080 = (video_height == 1088 ? 8 : 0); 424 418 425 nvp->SetVideoFilters(vidfilters); 419 426 newWidth = profile.byName("width")->getValue().toInt(); 420 427 newHeight = profile.byName("height")->getValue().toInt(); 421 428 422 429 // If height or width are 0, then we need to calculate them 423 430 if (newHeight == 0 && newWidth > 0) 424 newHeight = (int)(1.0 * newWidth * video_height/ video_width);431 newHeight = (int)(1.0 * newWidth * (video_height-fudge1080) / video_width); 425 432 else if (newWidth == 0 && newHeight > 0) 426 newWidth = (int)(1.0 * newHeight * video_width / video_height);433 newWidth = (int)(1.0 * newHeight * video_width / (video_height-fudge1080)); 427 434 else if (newWidth == 0 && newHeight == 0) 428 435 { 429 436 newHeight = 480; 430 newWidth = (int)(1.0 * 480 * video_width / video_height);437 newWidth = (int)(1.0 * 480 * video_width / (video_height-fudge1080)); 431 438 if (newWidth > 640) 432 439 { 433 440 newWidth = 640; 434 newHeight = (int)(1.0 * 640 * video_height/ video_width);441 newHeight = (int)(1.0 * 640 * (video_height-fudge1080) / video_width); 435 442 } 436 443 } 437 438 444 if (encodingType.left(4).lower() == "mpeg") 439 445 { 440 446 // make sure dimensions are valid for MPEG codecs 441 447 newHeight = (newHeight + 15) & ~0xF; 442 448 newWidth = (newWidth + 15) & ~0xF; 443 449 } 444 445 450 VERBOSE(VB_IMPORTANT, QString("Resizing from %1x%2 to %3x%4") 446 451 .arg(video_width).arg(video_height) 447 452 .arg(newWidth).arg(newHeight)); … … 786 791 video_width, video_height); 787 792 avpicture_fill(&imageOut, frame.buf, PIX_FMT_YUV420P, 788 793 newWidth, newHeight); 789 scontext = img_resample_init(newWidth, newHeight, 790 video_width, video_height); 794 if (video_height != 1088) { 795 scontext = img_resample_init(newWidth, newHeight, 796 video_width, video_height); 797 } else { 798 scontext = img_resample_full_init(newWidth, newHeight, 799 video_width, video_height, 800 0,8,0,0, 801 0,0,0,0); 802 } 791 803 img_resample(scontext, &imageOut, &imageIn); 792 804 img_resample_close(scontext); 793 805 } … … 832 844 video_width, video_height); 833 845 avpicture_fill(&imageOut, frame.buf, PIX_FMT_YUV420P, 834 846 newWidth, newHeight); 835 scontext = img_resample_init(newWidth, newHeight, 836 video_width, video_height); 847 if (video_height != 1088) { 848 scontext = img_resample_init(newWidth, newHeight, 849 video_width, video_height); 850 } 851 else 852 { 853 scontext = img_resample_full_init(newWidth, newHeight, 854 video_width, video_height, 855 0,8,0,0, 856 0,0,0,0); 857 } 858 837 859 img_resample(scontext, &imageOut, &imageIn); 838 860 img_resample_close(scontext); 839 861 }