Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
5th January 2014, 01:24 | #1 | Link |
Registered User
Join Date: Aug 2007
Posts: 374
|
JpegSource advanced JPEG decoder for Avisynth 2.6
As someone asked for JPEG decoder that does no colorspace conversions and provide YUV data directly, and I've written exactly such thing for some other project – here it is, JpegSource for Avisynth.
Current (2014.4.19) version: https://www.dropbox.com/s/rjnt0y3ead...ce_20140419.7z Previous (2014.1.5) version: https://www.dropbox.com/s/qvm4kn27b4f7bb9/JpegSource.7z Due to various chroma subsamplings of JPEG it's Avisynth 2.6 only plugin. And even current Avisynth 2.6 doesn't support all colorspaces that you can encounter in JPEG, like YUV440 and CMYK/YCCK, so to process them you'd have to use single-channel mode. To comply with other Avisynth restrictions multi-channel mode may also "un-crop" images a bit (to provide even width to YV16 etc.), while single-channel mode always returns exact dimensions. Syntax: JpegSource(string file, int rec, int channel, int length, float fps_num, int fps_den)
Beside simply decoding JPEG files it can try to "reconstruct" the data. Shouldn't hurt any image. On high-quality JPEGs change is insignificant, on strongly compressed can produce quite impressive results, but won't help on recompressed files where artifacts were produced by previous compressions. Reconstruction requires SSSE3 capable CPU. For example try on this file. Can also decode PJG-compressed JPEG files and JPEG files with arithmetic compression. Remember that JPEGs use PC levels, Rec.601 colorspace and MPEG1 chroma position most of the time. Sadly, there is no way now for source filter to provide such information and you'd have to set correct parameters manually when converting to other colorspaces. (Actually, there is something about chroma position, but it doesn't work.) License: free for non-commercial use, closed source. (Ad-infested software is not "non-commercial".) Usage Notes RGB JPEGs are decoded as YV24 etc. To get proper RGB combine them by Code:
MergeRGB(last, UToY8(), VToY8(), "RGB24"). Code:
YToUV(UToY8().Spline36Resize(last.width, last.height), VToY8().Spline36Resize(last.width, last.height), last) Last edited by SEt; 19th April 2014 at 10:03. |
Thread Tools | Search this Thread |
Display Modes | |
|
|