Hi,

On Fri, 6 Jan 2012, Justin Ruggles wrote:

The fate reference is updated because the previous test skipped a sample in
each encode() call due each input frame having an odd number of samples.
---
libavcodec/g722enc.c  |   62 +++++++++++++++++++++++++++++++++---------------
tests/ref/acodec/g722 |    8 +++---
2 files changed, 46 insertions(+), 24 deletions(-)

Looks sensible in general, but can you split it in two steps - first refactoring encode_trellis/encode_no_trellis/encode_byte, then later doing the behavioural change?

diff --git a/libavcodec/g722enc.c b/libavcodec/g722enc.c
index 1eed784..7b89955 100644
--- a/libavcodec/g722enc.c
+++ b/libavcodec/g722enc.c
@@ -56,6 +56,8 @@ static av_cold int g722_encode_init(AVCodecContext * avctx)
        }
    }

+    avctx->frame_size = PREV_SAMPLES_BUF_SIZE - 22;
+
    return 0;
}

I guess this is as good a default as any, but IMO this really doesn't have anything to do with the prev_samples buffer size, so perhaps it's less confusing to just declare it as some constant value. (For "normal" voip use, 320 perhaps would be a more common default, giving 20 ms packets.) A comment saying that it is arbitrary should at least be added.

// Martin
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to