panasonic 14 bits

Hello,

For Panasonic 14 bits compressed images (like for the S1H camera), I wrote a decoder (in Pascal).
It is very similar to the 12 bits compressed, but differs in some details from the routine found in dcraw.
The cmp=4 is the code dedicated to 14bits compressed. cmp=3 is the code for 12 bits compressed inspired from dcraw.c - it's probably easy to rewrite it in C readinf the dcraw source in parallel.

The code ran correctly on all images I have pumped for this camera from photographyblog.com .

Cheers, Raoul de Nyon

IF CMP=4 THEN { 14 binons avec compression : 128 bits pour 11 valeurs, 4 derniers binons du bloc toujours 0 }
BEGIN
FOR MODU:=0 TO HIGH(LIT_SH) DO
LIT_SH[MODU]:=MODU MOD 3=2;
FOR Q2:=0 TO IXY[2]-1 DO
BEGIN
MODU:=0;
FOR Q1:=0 TO IXY[1]-1 DO
BEGIN
WITH PRNZ[MODU AND 1] DO
BEGIN
IF MODU<=1 THEN
BEGIN
K:=LX(10);
PR:=K SHL 4 OR LX(4);
END
ELSE
BEGIN
IF LIT_SH[MODU] THEN
SH:=SHX[LX(2)];
K:=LX(10);
IF K<>0 THEN
BEGIN
DEC(PR, PUIS2[9+SH]);
IF (PR<=0) OR (SH=4) THEN
PR:=PR AND MASQ2[SH];
INC(PR, K SHL SH);
END;
END;
W16^[Q1]:=PR;
END;
INC(MODU);
IF MODU=11 THEN
BEGIN
MODU:=0;
K:=LX(4);
END;
END;
POUSSE_LIGNE(Q2);
END;
END
ELSE
BEGIN { CMP=3, 12 binons avec compression : 128 binons pour 14 valeurs }
FOR MODU:=0 TO HIGH(LIT_SH) DO
LIT_SH[MODU]:=MODU MOD 3=2;
SH:=0;
FOR Q2:=0 TO IXY[2]-1 DO
BEGIN
MODU:=0;
FOR Q1:=0 TO IXY[1]-1 DO
BEGIN
IF MODU=0 THEN
BEGIN
PRNZ[0].PR:=0;
PRNZ[0].NZ:=0;
PRNZ[1].PR:=0;
PRNZ[1].NZ:=0;
END;
IF LIT_SH[MODU] THEN
SH:=SHX[LX(2)];
WITH PRNZ[Q1 AND 1] DO
BEGIN
IF NZ=0 THEN
BEGIN
NZ:=LX(8);
IF (NZ<>0) OR (MODU>11) THEN
PR:=NZ SHL 4 OR LX(4);
END
ELSE
BEGIN
J:=LX(8);
IF J<>0 THEN
BEGIN
DEC(PR, PUIS2[7+SH]);
IF (PR<0) OR (SH=4) THEN
PR:=PR AND MASQ2[SH];
INC(PR, J SHL SH);
END;
END;
W16^[Q1]:=PR;
END;
INC(MODU);
IF MODU=14 THEN
MODU:=0;
END;
POUSSE_LIGNE(Q2);
END;
END;

Forums: 

Thank you for the info.

Thank you for the info.

Panasonic 14-bit decoder is already included in LibRaw latest 'public snapshot'

-- Alex Tutubalin @LibRaw LLC