From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 150D843922 for ; Fri, 2 Sep 2022 18:44:00 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E3BD568B9CC; Fri, 2 Sep 2022 21:43:57 +0300 (EEST) Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C1B2E68B357 for ; Fri, 2 Sep 2022 21:43:51 +0300 (EEST) Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-344f8f691e2so12151757b3.2 for ; Fri, 02 Sep 2022 11:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date; bh=PIh0R2VOdQbVsU7UynICKgKQEIGRk6ubf00dfP6fRXc=; b=E5bg2SHEAiSMqcqur+ypy56vix5qF7nH6XfuYgWRV1DtlZtVi+6j+gWlHnv17z32Hf 8JrSzC1fIOzR+NmL7pgRus4Dpg2MXmJ7V4VLXokC/E0q8FZWNAuu8zn4kUmJQaDrOs5Z gh7DuFU6Nc2Y3p37MJJsjcM3Fv2yfNfRVlCIdZBBHDECrpCbUmLDOboUHhCLieFaAGP7 0IPR+3Ux/MTzhHADeAg0C2713DKeEHNkoTEyUjZ12qwMm8ZwsstwuDC8THQkKL4fLIn5 b0KMpllEYrgf0YNfaMI2RpKxaLB1RtZdaZo/DcCrPM7BOmP/SWUQPBtyukilcQ5wrLqb NJ5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date; bh=PIh0R2VOdQbVsU7UynICKgKQEIGRk6ubf00dfP6fRXc=; b=3sHDC0HyO6pHQj/7ZMLaIHJK2WEO8VeMrlMsmRqC6uGxyY3WL6FaCfq7JkVcQsh88e 8iRlEbs630hYOlpE3tA79QEBFy8qOiElr42G1B05jY4VESmxzEvwYQOhdB87Nu+pRUQo R1B8LCzBpX2s/MjDjyyacWDBjtoH6rBozVJUXHdBbJCoY7VpUE9m4urnUQ0qPzH+93N6 2hPgAaYvaGlJU/WtQIkmT75kCfqM+EJP76yHFEQfoPVZOKCkH6eIxyThf8xHRAax6w8w H55lMxtXkf5H7UR3n+tktK1MekP2nm/QQnRRYcHsjjOy99di5qcmw9FSOM94AmbIUH3n ZStA== X-Gm-Message-State: ACgBeo22jFQHX9yJ07y2o20ULTT03eBVJeAAoZWOyZN0hkrZLMx72I3p YqFCRCcOKA2WS94p2woHR9WL+WYneMfZBb2vlNBOmORb/hhXqw== X-Google-Smtp-Source: AA6agR6B6GXgEu6ePq+K81DgRA/CWcvOkHJSDN64y7cd74tCCem5+sJ0iOTUuGpCrZowq9WDLHByrCL3C/Dd5ZgnNO0= X-Received: by 2002:a81:1192:0:b0:33e:9091:ae81 with SMTP id 140-20020a811192000000b0033e9091ae81mr28876455ywr.211.1662144230217; Fri, 02 Sep 2022 11:43:50 -0700 (PDT) MIME-Version: 1.0 References: <20220902142028.261480-1-mvanb1@gmail.com> <20220902142028.261480-3-mvanb1@gmail.com> In-Reply-To: From: Martijn van Beurden Date: Fri, 2 Sep 2022 20:43:37 +0200 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH v3 2/2] libavcodec/flacenc: Implement encoding of 32 bit-per-sample PCM X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: First of all, thanks for reviewing. Op vr 2 sep. 2022 om 17:11 schreef Andreas Rheinhardt < andreas.rheinhardt@outlook.com>: > > +static inline void put_sbits64(PutBitContext *pb, int n, int64_t value) > > +{ > > + av_assert2(n >= 0 && n <= 64); > > + > > + put_bits64(pb, n, (uint64_t)(value) & (~(UINT64_MAX << n))); > > Shifting by 64 bits here is UB, so better modify the assert to disallow > it. And rename the function to put_sbits63(). > > I could also add specific handling for the 64-bit case. Perhaps something like put_bits64(pb, n, (uint64_t)(value) & (~((n < 64)?(UINT64_MAX << n):0))); or should I leave that to whoever needs that functionality? > > -static inline void set_sr_golomb_flac(PutBitContext *pb, int i, int k, > > - int limit, int esc_len) > > +static inline void set_sr_golomb_flac(PutBitContext *pb, int i, int k) > > This seems to be only used by flacenc.c, so IMO it would be better to > move it there. > > Yes, I was wondering what to do with this, similarly with the functions in get_bits, mathops and put_bits. I suppose the additions to get_bits, mathops and put_bits might be useful to others in the future. The golomb code is probably not useful for other codecs indeed. Is that reasoning valid? _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".