&rfx_sendmsg (
qq{
(begin
(when (= $start $frame)
(define color-match-image (car (gimp-file-load RUN-NONINTERACTIVE "$in2" "$in2")))
(gimp-image-undo-disable color-match-image)
(gimp-image-scale-full color-match-image $width $height INTERPOLATION-CUBIC)
(gimp-convert-indexed color-match-image NO-DITHER MAKE-PALETTE 256 FALSE TRUE "") )
(let* ((input-file (string-append "$curtmpdir" DIR-SEPARATOR "$in"))
(image (car (gimp-file-load RUN-NONINTERACTIVE input-file input-file)))
(layer (car (gimp-image-get-active-layer image)))
(decomp-mode "LAB")
; (decomp-mode "YCbCr_ITU_R709")
; (decomp-mode "YCbCr_ITU_R470")
(cb-image (car (gimp-image-duplicate color-match-image)))
(decomp-layer 0)
(y-images '())
(uv-images '()) )
(gimp-image-undo-disable image)
(gimp-image-undo-disable cb-image)
(set! decomp-layer (car (gimp-layer-new-from-drawable layer cb-image)))
(gimp-image-add-layer cb-image decomp-layer 0)
(gimp-convert-rgb cb-image)
(let ((y-images (plug-in-decompose RUN-NONINTERACTIVE
image
layer
decomp-mode
FALSE ))
(uv-images (plug-in-decompose RUN-NONINTERACTIVE
cb-image
decomp-layer
decomp-mode
FALSE )) )
(gimp-image-delete cb-image)
(set! cb-image (car (plug-in-compose RUN-NONINTERACTIVE
(car y-images)
0
(cadr uv-images)
(caddr uv-images)
(cadddr y-images)
decomp-mode )))
(map (lambda (x) (unless (< x 1) (gimp-image-delete x))) y-images)
(map (lambda (x) (unless (< x 1) (gimp-image-delete x))) uv-images) )
(gimp-image-delete image)
(gimp-image-merge-visible-layers cb-image CLIP-TO-IMAGE)
(rfx-save-frame cb-image "$out")
)
)
}
);