Add gtests

refactor and add decode_encode_test to pipeline decoder output to encoder test.