<div dir="ltr">Attached is an updated patch based on Jean-Marc and Mark's comments. :)<div><br></div><div>Cheers,</div><div>Drew</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Mar 20, 2018 at 9:20 AM Jean-Marc Valin <<a href="mailto:jmvalin@jmvalin.ca">jmvalin@jmvalin.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 03/20/2018 11:51 AM, Drew Allen wrote:<br>
> Just to confirm, I would use opeint_* for all the<br>
> OpusGenericEncoder-related functions?<br>
<br>
Correct. Or you can also use oge_ if you like. Just don't use something<br>
that starts with an underscore.<br>
<br>
<br>
> On Tue, Mar 20, 2018 at 8:38 AM Jean-Marc Valin <<a href="mailto:jmvalin@jmvalin.ca" target="_blank">jmvalin@jmvalin.ca</a><br>
> <mailto:<a href="mailto:jmvalin@jmvalin.ca" target="_blank">jmvalin@jmvalin.ca</a>>> wrote:<br>
><br>
>Â Â Â Hi Mark, Drew,<br>
><br>
>Â Â Â On 03/20/2018 02:40 AM, Mark Harris wrote:<br>
>Â Â Â > + int _oge_use_projection(int channel_mapping);<br>
>Â Â Â ><br>
>Â Â Â > These functions are part of libopusenc, so I'd expect them to have an<br>
>Â Â Â > ope prefix like the other functions in the libopusenc library.<br>
><br>
>Â Â Â I'd like to avoid using the ope_ prefix for functions that's aren't in<br>
>Â Â Â the public API. Right now there are other functions with a leading<br>
>Â Â Â underscore, so we'll have to fix them as well (not in this patch of<br>
>Â Â Â course). Maybe an "opeint_" prefix would do the job here (unless anyone<br>
>Â Â Â has a better idea)?<br>
><br>
>Â Â Â > +int ope_encoder_deferred_init_with_mapping(OggOpusEnc *enc, int<br>
>Â Â Â > family, int streams,<br>
>Â Â Â >Â Â Â int coupled_streams, const unsigned char *mapping) {<br>
>Â Â Â >Â Â int ret;<br>
>Â Â Â >Â Â int i;<br>
>Â Â Â ><br>
>Â Â Â > This code is allowing family 253 for a deferred init, but does not<br>
>Â Â Â > create a projection encoder in that case, so it looks like it will<br>
>Â Â Â > fail when writing the id header since it won't be able to get the<br>
>   > demixing matrix. It should probably not be allowing family 253 here.<br>
><br>
>Â Â Â Actually, in the case of ope_encoder_deferred_init_with_mapping(), I<br>
>Â Â Â think it's probably best to just keep the existing code (not use<br>
>Â Â Â wrappers), since that function cannot be used by the projection encoder<br>
>Â Â Â at all.<br>
><br>
>Â Â Â Â Â Â Â Jean-Marc<br>
><br>
><br>
>Â Â Â >Â - Mark<br>
>Â Â Â ><br>
>Â Â Â ><br>
>Â Â Â > On Mon, Mar 19, 2018 at 3:00 PM, Drew Allen <<a href="mailto:bitllama@google.com" target="_blank">bitllama@google.com</a><br>
>Â Â Â <mailto:<a href="mailto:bitllama@google.com" target="_blank">bitllama@google.com</a>>> wrote:<br>
>Â Â Â >> Hi Jean-Marc,<br>
>Â Â Â >><br>
>Â Â Â >> I've modified my patches for libopus and libopusenc based on your<br>
>Â Â Â >> suggestions.<br>
>Â Â Â >><br>
>Â Â Â >> Cheers,<br>
>Â Â Â >> Drew<br>
>Â Â Â >><br>
>Â Â Â >> On Mon, Mar 19, 2018 at 2:05 PM Jean-Marc Valin<br>
>Â Â Â <<a href="mailto:jmvalin@jmvalin.ca" target="_blank">jmvalin@jmvalin.ca</a> <mailto:<a href="mailto:jmvalin@jmvalin.ca" target="_blank">jmvalin@jmvalin.ca</a>>> wrote:<br>
>Â Â Â >>><br>
>Â Â Â >>> Hi Drew,<br>
>Â Â Â >>><br>
>Â Â Â >>> I think the libopusenc patch is better, but there's still a few<br>
>Â Â Â issues<br>
>Â Â Â >>> left:<br>
>Â Â Â >>> 1) The static MAX_PACKET_BUFFER_SIZE value is still problematic<br>
>Â Â Â because<br>
>Â Â Â >>> if you link libopusenc with a new version of libopus that supports<br>
>Â Â Â >>> higher order projection or just more projection channels for<br>
>Â Â Â order 3,<br>
>Â Â Â >>> then you will overflow the buffer. I think what you'd want is a<br>
>Â Â Â >>> _ope_opus_header_get_size() call that would return how large the<br>
>Â Â Â header<br>
>Â Â Â >>> *actually* is. Then you can use that value instead of<br>
>Â Â Â >>> MAX_PACKET_BUFFER_SIZE in init_stream()<br>
>Â Â Â >>> 2) I think the remaining if()s in ope_encoder_ctl() can also be<br>
>Â Â Â removed<br>
>Â Â Â >>> by adding another ctl() macro (like _oge_ctl()) with an extra<br>
>Â Â Â argument.<br>
>Â Â Â >>> In the case of OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST, you can<br>
>Â Â Â >>> simply use _oge_ctl(enc->st,<br>
>Â Â Â >>> OPUS_MULTISTREAM_GET_ENCODER_STATE(stream_id, value))<br>
>Â Â Â >>> 3) On libopus itself, why "#define OPUS_HAVE_OPUS_PROJECTION_H 9000"<br>
>Â Â Â >>> instead of just "#define OPUS_HAVE_OPUS_PROJECTION_H"?<br>
>Â Â Â >>><br>
>Â Â Â >>> Cheers,<br>
>Â Â Â >>><br>
>Â Â Â >>>Â Â Â Â Â Jean-Marc<br>
>Â Â Â >>><br>
>Â Â Â >>> On 03/19/2018 02:53 PM, Drew Allen wrote:<br>
>Â Â Â >>>><br>
>Â Â Â >>>> On Mon, Mar 19, 2018 at 11:52 AM Drew Allen<br>
>Â Â Â <<a href="mailto:bitllama@google.com" target="_blank">bitllama@google.com</a> <mailto:<a href="mailto:bitllama@google.com" target="_blank">bitllama@google.com</a>><br>
>Â Â Â >>>> <mailto:<a href="mailto:bitllama@google.com" target="_blank">bitllama@google.com</a> <mailto:<a href="mailto:bitllama@google.com" target="_blank">bitllama@google.com</a>>>> wrote:<br>
>Â Â Â >>>><br>
>Â Â Â >>>>Â Â Â Hello all,<br>
>Â Â Â >>>><br>
>Â Â Â >>>>Â Â Â Sorry for the delay (got really sick last week).<br>
>Â Â Â >>>><br>
>Â Â Â >>>>Â Â Â Attached are updated patches for libopus, libopusenc,<br>
>Â Â Â opusfile and<br>
>Â Â Â >>>>Â Â Â opus-tools.<br>
>Â Â Â >>>><br>
>Â Â Â >>>>Â Â Â Note that the patches for libopusenc, opusfile and<br>
>Â Â Â opus-tools are<br>
>Â Â Â >>>>Â Â Â dependent on the patch for libopus.<br>
>Â Â Â >>>><br>
>Â Â Â >>>>Â Â Â Please let me know if you have any additional followup<br>
>Â Â Â comments or<br>
>Â Â Â >>>>Â Â Â questions.<br>
>Â Â Â >>>><br>
>Â Â Â >>>>Â Â Â Cheers,<br>
>Â Â Â >>>>Â Â Â Drew<br>
>Â Â Â >>>><br>
>Â Â Â >>>><br>
>Â Â Â >>>><br>
>Â Â Â >>>> _______________________________________________<br>
>Â Â Â >>>> opus mailing list<br>
>Â Â Â >>>> <a href="mailto:opus@xiph.org" target="_blank">opus@xiph.org</a> <mailto:<a href="mailto:opus@xiph.org" target="_blank">opus@xiph.org</a>><br>
>Â Â Â >>>> <a href="http://lists.xiph.org/mailman/listinfo/opus" rel="noreferrer" target="_blank">http://lists.xiph.org/mailman/listinfo/opus</a><br>
>Â Â Â >>>><br>
>Â Â Â >><br>
>Â Â Â >><br>
>Â Â Â >> _______________________________________________<br>
>Â Â Â >> opus mailing list<br>
>Â Â Â >> <a href="mailto:opus@xiph.org" target="_blank">opus@xiph.org</a> <mailto:<a href="mailto:opus@xiph.org" target="_blank">opus@xiph.org</a>><br>
>Â Â Â >> <a href="http://lists.xiph.org/mailman/listinfo/opus" rel="noreferrer" target="_blank">http://lists.xiph.org/mailman/listinfo/opus</a><br>
>Â Â Â >><br>
><br>
</blockquote></div></div>