<div dir="ltr">Hi all,<div><br></div><div>I am reading a lot this example lately and I have a question that I cannot quite answer myself. Here is the deal (<a href="https://www.ffmpeg.org/doxygen/2.4/filtering__audio_8c_source.html#l00182">https://www.ffmpeg.org/doxygen/2.4/filtering__audio_8c_source.html#l00182</a>), in print_frame there is a cast to uint16_t:<br><br><span class="" style="color:rgb(0,128,0);font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)">const</span><span style="color:rgb(0,0,0);font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)"> uint16_t *p     = (uint16_t*)frame-></span><a class="" href="https://www.ffmpeg.org/doxygen/2.4/structAVFrame.html#a1d0f65014a8d1bf78cec8cbed2304992" title="pointer to the picture/channel planes." style="color:rgb(70,101,162);text-decoration:none;font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)">data</a><span style="color:rgb(0,0,0);font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)">[0];</span></div><div><div style><font color="#000000" face="monospace, fixed"><span style="line-height:10.3999996185303px;white-space:pre-wrap"><br></span></font></div>however the filtering description is set with s16:<br><br><span class="" style="color:rgb(0,128,0);font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)">static</span><span style="color:rgb(0,0,0);font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)"> </span><span class="" style="color:rgb(0,128,0);font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)">const</span><span style="color:rgb(0,0,0);font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)"> </span><span class="" style="color:rgb(96,64,32);font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)">char</span><span style="color:rgb(0,0,0);font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)"> *</span><a class="" href="https://www.ffmpeg.org/doxygen/2.4/filtering__audio_8c.html#a84b31b94c024a45c4bcebd875a54e73d" style="color:rgb(70,101,162);text-decoration:none;font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)">filter_descr</a><span style="color:rgb(0,0,0);font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)"> = </span><span class="" style="color:rgb(0,32,128);font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)">"aresample=8000,aformat=sample_fmts=s16:channel_layouts=mono"</span><span style="color:rgb(0,0,0);font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)">;
</span><br>Now I tried to change the cast to int16_t instead of uint16_t and I have no audible change in the filtered stream when played back by ffplay (<span style="color:rgb(0,32,128);font-family:monospace,fixed;font-size:12.8000001907349px;line-height:10.3999996185303px;white-space:pre-wrap;background-color:rgb(251,252,253)">ffplay -f s16le -ar 8000 -ac 1 -</span>).</div><div><br></div><div><br></div><div><br></div><div>My question is, when casting signed to unsigned, is there any possibility that the signal gets modified due to the 2-complementation (or are the samples always positive somehow) ? <br></div><div>
</div></div>