#!/bin/sh
#
 
DEST=../tmn-x

for file in *.c *.h; do
#    test $DEST/$file -nt $file && continue
    echo -n "$file... "
    sed < $file > $DEST/$file \
-e "s/cumf_MODB_G/sed_cumf_MODB_G/g" \
-e "s/cumf_YCBPB/sed_cumf_YCBPB/g" \
-e "s/cumf_UVCBPB/sed_cumf_UVCBPB/g" \
-e "s/cumf_CBPY/sed_cumf_CBPY/g" \
-e "s/cumf_CBPY_intra/sed_cumf_CBPY_intra/g" \
-e "s/cumf_DQUANT/sed_cumf_DQUANT/g" \
-e "s/cumf_MVD/sed_cumf_MVD/g" \
-e "s/cumf_INTRADC/sed_cumf_INTRADC/g" \
-e "s/cumf_TCOEF1/sed_cumf_TCOEF1/g" \
-e "s/cumf_TCOEF2/sed_cumf_TCOEF2/g" \
-e "s/cumf_TCOEF3/sed_cumf_TCOEF3/g" \
-e "s/cumf_TCOEFr/sed_cumf_TCOEFr/g" \
-e "s/cumf_TCOEF1_intra/sed_cumf_TCOEF1_intra/g" \
-e "s/cumf_TCOEF2_intra/sed_cumf_TCOEF2_intra/g" \
-e "s/cumf_TCOEF3_intra/sed_cumf_TCOEF3_intra/g" \
-e "s/cumf_TCOEFr_intra/sed_cumf_TCOEFr_intra/g" \
-e "s/cumf_SIGN/sed_cumf_SIGN/g" \
-e "s/cumf_LAST/sed_cumf_LAST/g" \
-e "s/cumf_LAST_intra/sed_cumf_LAST_intra/g" \
-e "s/cumf_RUN/sed_cumf_RUN/g" \
-e "s/cumf_RUN_intra/sed_cumf_RUN_intra/g" \
-e "s/cumf_LEVEL/sed_cumf_LEVEL/g" \
-e "s/cumf_LEVEL_intra/sed_cumf_LEVEL_intra/g" \
-e "s/cumf_INTRA_AC_DC/sed_cumf_INTRA_AC_DC/g" \
-e "s/codtab/sed_codtab/g" \
-e "s/mcbpctab/sed_mcbpctab/g" \
-e "s/mcbpctab_4mvq/sed_mcbpctab_4mvq/g" \
-e "s/mcbpc_intratab/sed_mcbpc_intratab/g" \
-e "s/cbpytab/sed_cbpytab/g" \
-e "s/cbpy_intratab/sed_cbpy_intratab/g" \
-e "s/dquanttab/sed_dquanttab/g" \
-e "s/mvdtab/sed_mvdtab/g" \
-e "s/intradctab/sed_intradctab/g" \
-e "s/tcoeftab/sed_tcoeftab/g" \
-e "s/signtab/sed_signtab/g" \
-e "s/lasttab/sed_lasttab/g" \
-e "s/last_intratab/sed_last_intratab/g" \
-e "s/runtab/sed_runtab/g" \
-e "s/leveltab/sed_leveltab/g" \
-e "s/initbits/sed_initbits/g" \
-e "s/DCT3Dtab0/sed_DCT3Dtab0/g" \
-e "s/DCT3Dtab1/sed_DCT3Dtab1/g" \
-e "s/DCT3Dtab2/sed_DCT3Dtab2/g" \
-e "s/fill_A/sed_fill_A/g" \
-e "s/fill_null/sed_fill_null/g" \
-e "s/fill_B/sed_fill_B/g" \
-e "s/Intra_AC_DC_Decode/sed_Intra_AC_DC_Decode/g" \
-e "s/clipAC/sed_clipAC/g" \
-e "s/oddifyclipDC/sed_oddifyclipDC/g" \
-e "s/clipDC/sed_clipDC/g" \
-e "s/init_idctref/sed_init_idctref/g" \
-e "s/idctref/sed_idctref/g" \
    -e 's/UpsampleReferenceLayerPicture/sed_UpsampleReferenceLayerPicture/g' \
    -e 's/UpsampleComponent/sed_UpsampleComponent/g' \
    -e 's/cumf_COD/sed_cumf_COD/g' \
    -e 's/cumf_MCBPC_no4MVQ/sed_cumf_MCBPC_no4MVQ/g' \
    -e 's/cumf_MCBPC_4MVQ/sed_cumf_MCBPC_4MVQ/g' \
    -e 's/cumf_MCBPC_intra/sed_cumf_MCBPC_intra/g' \
    -e 's/cumf_MODB_M/sed_cumf_MODB_M/g' \
    -e 's/lines/sed_lines/g' \
    -e 's/pels/sed_pels/g'
    echo "ok"
done

cp Makefile.lib $DEST/Makefile
(cd $DEST; make)
