JpegSource
m (→Description) |
m (author) |
||
(11 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | {{FilterCat|External_filters | + | {{FilterCat|External_filters|Plugins|Source_filters}} |
− | {{ | + | {{Filter3 |
− | | SEt | + | | {{Author/SEt}} |
| 2014.4.19 | | 2014.4.19 | ||
− | | [ | + | | [https://dl.dropboxusercontent.com/s/rjnt0y3ead2c6ef/JpegSource_20140419.7z JpegSource_20140419.7z] |
| Source filters | | Source filters | ||
− | | | + | | Free for non-commercial use, closed source. |
− | |}} | + | |6=[http://forum.doom9.org/showthread.php?t=170028 Doom9 Thread]}} |
− | + | ||
== Description == | == Description == | ||
− | + | An advanced JPEG decoder for AviSynth 2.6 which decodes JPEGs directly in their native colorspace. It supports [http://en.wikipedia.org/wiki/Arithmetic_coding arithmetic] and [http://en.wikipedia.org/wiki/Huffman_coding Huffman] encoded JPEGs. In addition, JpegSource has an optional reconstruction pass that can only be done during the decoding stage. This process can accurately suppress common JPEG artifacts (blocking, ringing/mosquito noise, etc). The reconstruction pass is harmless on high quality JPEGs but can produce excellent results on highly compressed JPEGs. This technique yields better results than other post-processing methods. | |
− | + | <br> | |
− | + | ||
− | + | ||
<br> | <br> | ||
− | |||
== Supported Formats == | == Supported Formats == | ||
− | + | JpegSource supports just about every kind of JPEG file, but due to lack of colorspace support in AviSynth some formats need additional steps to load: | |
− | : | + | |
+ | :*YUV440 JPEGs - channels have to be loaded individually, see the [[JpegSource#Examples|examples]] below. | ||
+ | :*CMYK/YCCK JPEGs - channels have to be loaded individually. | ||
+ | :*RGB encoded JPEGs - to load correctly see the [[JpegSource#Examples|examples]] below. | ||
+ | :*RGB JPEGs other than 4:4:4 have to be loaded manually and converted to a supported format manually. | ||
+ | |||
+ | This may seem cumbersome but the idea of this source filter is to provide the actual encoded data without any colorspace conversions or resizes (these are usually really poor quality in other decoders).<br> | ||
+ | AviSynth colorspace support is quite limited, fortunately most common JPEG formats are natively supported in AviSynth 2.6 (Y8, YV12, YV16, YV24 and YV411). | ||
+ | |||
+ | Remember that JPEGs use PC levels, Rec.601 colorspace and [[Sampling#mpeg-1_versus_mpeg-2_sampling|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. | ||
− | |||
− | |||
− | |||
<br> | <br> | ||
− | |||
− | |||
− | |||
− | : | + | == Requirements == |
+ | * [x86]: [[AviSynth+]] or [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6] | ||
+ | *Supported color formats: [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]] | ||
+ | |||
+ | *[[SSE2]] capbale CPU / [[SSSE3]] capable CPU for reconstruction pass only | ||
<br> | <br> | ||
+ | |||
== [[Script variables|Syntax and Parameters]] == | == [[Script variables|Syntax and Parameters]] == | ||
:{{Template:FuncDef|JpegSource (''string'' file, ''int'' "rec", ''int'' "channel", ''int'' "length", ''float'' "fps_num", ''int'' "fps_den")}} | :{{Template:FuncDef|JpegSource (''string'' file, ''int'' "rec", ''int'' "channel", ''int'' "length", ''float'' "fps_num", ''int'' "fps_den")}} | ||
Line 36: | Line 41: | ||
<br> | <br> | ||
::{{Par2|rec|int|1}} | ::{{Par2|rec|int|1}} | ||
− | :::Number of reconstruction passes. | + | :::Number of reconstruction passes; set to 0 to disable, it's the default if [[SSSE3]] is not supported [http://forum.doom9.org/showpost.php?p=1677817&postcount=27]. |
+ | :::Reconstruction pass won't help on recompressed files where artifacts were produced by previous compressions. | ||
<br> | <br> | ||
::{{Par2|channel|int|-1}} | ::{{Par2|channel|int|-1}} | ||
Line 56: | Line 62: | ||
:::FPS denominator. | :::FPS denominator. | ||
<br> | <br> | ||
+ | |||
== Examples == | == Examples == | ||
JpegSource with default settings: | JpegSource with default settings: | ||
JpegSource("image.jpg", rec=1, channel=-1, length=1000, fps_num=24, fps_den=1) | JpegSource("image.jpg", rec=1, channel=-1, length=1000, fps_num=24, fps_den=1) | ||
<br> | <br> | ||
− | Correctly display | + | Correctly display a 4:4:4 RGB encoded JPEG: |
JpegSource("RGBimage.jpg") | JpegSource("RGBimage.jpg") | ||
[[MergeRGB]](last, UToY8(), VToY8(), "RGB24") | [[MergeRGB]](last, UToY8(), VToY8(), "RGB24") | ||
+ | <br> | ||
+ | Load and convert a 4:4:0 subsampled JPEG to 4:4:4 ([[YV24]]): | ||
+ | source = "440image.jpg"<br> | ||
+ | Y = JpegSource(source, channel=0) | ||
+ | U = JpegSource(source, channel=1).Spline36Resize(Y.width(), Y.height()) | ||
+ | V = JpegSource(source, channel=2).Spline36Resize(Y.width(), Y.height())<br> | ||
+ | [[YToUV]](U,V,Y) | ||
<br> | <br> | ||
== Changelog == | == Changelog == | ||
Version Date Changes<br> | Version Date Changes<br> | ||
− | 2014.4.19 04/19/2010 - Added single-channel mode, so you can load pretty much every JPEG you can encounter even when | + | 2014.4.19 04/19/2010 - Added single-channel mode, so you can load pretty much every JPEG you |
− | + | can encounter even when Avisynth doesn't have an appropriate colorspace.<br> | |
2014.4.18 04/18/2014 - Support JPEGs with arithmetic compression. | 2014.4.18 04/18/2014 - Support JPEGs with arithmetic compression. | ||
- No longer locks files after first frame was decoded. | - No longer locks files after first frame was decoded. | ||
Line 73: | Line 87: | ||
- Changed compiler to VS2013.<br> | - Changed compiler to VS2013.<br> | ||
2014.1.5 01/05/2014 - Initial release | 2014.1.5 01/05/2014 - Initial release | ||
+ | <br> | ||
+ | == Archived Downloads == | ||
+ | {| class="wikitable" border="1"; width="500px" | ||
+ | |- | ||
+ | !!width="100px"| Version | ||
+ | !!width="150px"| Download | ||
+ | !!width="150px"| Mirror | ||
+ | |- | ||
+ | !2014.4.19 | ||
+ | |[https://dl.dropboxusercontent.com/s/rjnt0y3ead2c6ef/JpegSource_20140419.7z JpegSource_20140419.7z] | ||
+ | |[https://web.archive.org/web/20200616181051if_/https://files.videohelp.com/u/223002/JpegSource_20140419.7z JpegSource_20140419.7z] | ||
+ | |||
+ | |} | ||
<br> | <br> | ||
== External Links == | == External Links == | ||
*[http://forum.doom9.org/showthread.php?t=170028 Doom9 Forum] - JpegSource discussion. | *[http://forum.doom9.org/showthread.php?t=170028 Doom9 Forum] - JpegSource discussion. | ||
− | + | *[http://dougkerr.net/Pumpkin/articles/Subsampling.pdf Subsampling.pdf] - pages 3-6 has good information on JPEG subsampling and chroma placement ("centered" and "co-sited"). | |
+ | *[http://www.poynton.com/PDFs/Chroma_subsampling_notation.pdf Chroma_subsampling_notation.pdf] - Page 2 describes JPEG/JFIF, H.261, and MPEG-1 as having the same chroma placement. | ||
<br> | <br> | ||
<br> | <br> | ||
----------------------------------------------- | ----------------------------------------------- | ||
'''Back to [[External_filters#Source_Filters|External Filters]] ←''' | '''Back to [[External_filters#Source_Filters|External Filters]] ←''' |
Latest revision as of 19:18, 16 June 2020
Abstract | |
---|---|
Author | SEt |
Version | 2014.4.19 |
Download | JpegSource_20140419.7z |
Category | Source filters |
License | Free for non-commercial use, closed source. |
Discussion | Doom9 Thread |
Contents |
[edit] Description
An advanced JPEG decoder for AviSynth 2.6 which decodes JPEGs directly in their native colorspace. It supports arithmetic and Huffman encoded JPEGs. In addition, JpegSource has an optional reconstruction pass that can only be done during the decoding stage. This process can accurately suppress common JPEG artifacts (blocking, ringing/mosquito noise, etc). The reconstruction pass is harmless on high quality JPEGs but can produce excellent results on highly compressed JPEGs. This technique yields better results than other post-processing methods.
[edit] Supported Formats
JpegSource supports just about every kind of JPEG file, but due to lack of colorspace support in AviSynth some formats need additional steps to load:
- YUV440 JPEGs - channels have to be loaded individually, see the examples below.
- CMYK/YCCK JPEGs - channels have to be loaded individually.
- RGB encoded JPEGs - to load correctly see the examples below.
- RGB JPEGs other than 4:4:4 have to be loaded manually and converted to a supported format manually.
This may seem cumbersome but the idea of this source filter is to provide the actual encoded data without any colorspace conversions or resizes (these are usually really poor quality in other decoders).
AviSynth colorspace support is quite limited, fortunately most common JPEG formats are natively supported in AviSynth 2.6 (Y8, YV12, YV16, YV24 and YV411).
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.
[edit] Requirements
[edit] Syntax and Parameters
- JpegSource (string file, int "rec", int "channel", int "length", float "fps_num", int "fps_den")
- string file =
- Path to image file. Path can be omitted if the script is in the same folder as the image file.
- string file =
- int channel = -1
- Load only one image channel with specified index (zero based).
- int channel = -1
- -1 : load all channels
- 0 : load 1st channel
- 1 : load 2nd channel
- 2 : load 3rd channel
- 3 : load 4th channel (only for CMYK/YCCK JPEGs)
- int length = 1000
- Clip length in frames.
- int length = 1000
- float fps_num = 24
- FPS numerator.
- float fps_num = 24
- int fps_den = 1
- FPS denominator.
- int fps_den = 1
[edit] Examples
JpegSource with default settings:
JpegSource("image.jpg", rec=1, channel=-1, length=1000, fps_num=24, fps_den=1)
Correctly display a 4:4:4 RGB encoded JPEG:
JpegSource("RGBimage.jpg") MergeRGB(last, UToY8(), VToY8(), "RGB24")
Load and convert a 4:4:0 subsampled JPEG to 4:4:4 (YV24):
source = "440image.jpg"
Y = JpegSource(source, channel=0) U = JpegSource(source, channel=1).Spline36Resize(Y.width(), Y.height()) V = JpegSource(source, channel=2).Spline36Resize(Y.width(), Y.height())
YToUV(U,V,Y)
[edit] Changelog
Version Date Changes
2014.4.19 04/19/2010 - Added single-channel mode, so you can load pretty much every JPEG you can encounter even when Avisynth doesn't have an appropriate colorspace.
2014.4.18 04/18/2014 - Support JPEGs with arithmetic compression. - No longer locks files after first frame was decoded. - Added MT and cache hints for AviSynth+. - Changed compiler to VS2013.
2014.1.5 01/05/2014 - Initial release
[edit] Archived Downloads
Version | Download | Mirror |
---|---|---|
2014.4.19 | JpegSource_20140419.7z | JpegSource_20140419.7z |
[edit] External Links
- Doom9 Forum - JpegSource discussion.
- Subsampling.pdf - pages 3-6 has good information on JPEG subsampling and chroma placement ("centered" and "co-sited").
- Chroma_subsampling_notation.pdf - Page 2 describes JPEG/JFIF, H.261, and MPEG-1 as having the same chroma placement.
Back to External Filters ←