On Thu, Apr 11, 2013 at 03:44:48PM +0200, Nicolas Bertrand wrote:
> For testing purpose. Used to test XYZ JPEG2000 output
> ---
> libavfilter/Makefile | 1 +
> libavfilter/allfilters.c | 1 +
> libavfilter/vf_xyz2rgb.c | 201
> ++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 203 insertions(+)
> create mode 100644 libavfilter/vf_xyz2rgb.c
This is missing a version bump and a changelog entry.
> --- /dev/null
> +++ b/libavfilter/vf_xyz2rgb.c
> @@ -0,0 +1,201 @@
> +
> +typedef struct {
> + int xyzgamma[4096];
> + int rgbgamma[4096];
> + int (* matrix)[3];
> +} XYZ2RGBContext;
Please avoid anonymous typedefs.
> +static int xyz2rgb_matrix[3][3] = {
> + {13270, -6295, -2041},
> + {-3969, 7682, 170},
> + { 228, -835, 4329} };
spaces inside {}
> +static int query_formats(AVFilterContext * ctx)
*ctx
> +/**
> + * The gamma values are precalculated in an array
> + * XYZ uses projector gamma 2.6
> + * sRGB uses gamma 2.2
> + * The gamma function is the inverse power function, calculated in [0..1]
> and scaled to 12-bit fixed point
> + *
> + * The matrix multipliers are precalculated and scaled to 12bit bitdepth
> (4096 values)
> + * For documentation see
> + * http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
> + * http://en.wikipedia.org/wiki/SRGB
This looks like a purely internal comment for a static function;
no need for Doxygen.
> +*/
> +
> +static int config_props(AVFilterLink * inlink)
Drop the empty line.
*inlink, more below
> +static int filter_frame(AVFilterLink * inlink, AVFrame * in)
> +{
> + AVFilterLink *outlink = inlink->dst->outputs[0];
> + XYZ2RGBContext *settings = inlink->dst->priv;
nit: vertical align
> + out->pts = in->pts;
> + inrow = in->data[0];
> + outrow = out->data[0];
same
> + // read little endian and scale from 16bit to 12bit
little-endian
> + inrow += in->linesize[0];
> + outrow += out->linesize[0];
align
> +AVFilter avfilter_vf_xyz2rgb = {
> + .name = "xyz2rgb",
> + .description = NULL_IF_CONFIG_SMALL("Converts XYZ to RGB."),
> + .priv_size = sizeof(XYZ2RGBContext),
> + .query_formats = query_formats,
> + .inputs = (const AVFilterPad[]) {{.name = "default",
> + .type = AVMEDIA_TYPE_VIDEO,
> + .filter_frame = filter_frame,
> + .config_props = config_props,
> + .min_perms = AV_PERM_READ,},
> + {.name = NULL}},
> + .outputs = (const AVFilterPad[]) {{.name = "default",
> + .type = AVMEDIA_TYPE_VIDEO,},
> + {.name = NULL}},
spaces inside {}, vertically align the =
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel