libgd: rework jpeg patch