]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/targa.c
Remove a pointless right-shift in xan decoder.
[ffmpeg] / libavcodec / targa.c
index d637bedae56b4fe0e3f8ffa2a40a9594793b0419..10b1aa47f251fc5b5800b4cb3c50e8641ff092d7 100644 (file)
@@ -17,8 +17,9 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  */
+
+#include "libavutil/intreadwrite.h"
 #include "avcodec.h"
 
 enum TargaCompr{
@@ -38,7 +39,7 @@ typedef struct TargaContext {
     int compression_type;
 } TargaContext;
 
-static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, uint8_t *src, uint8_t *dst, int w, int h, int stride, int bpp)
+static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, const uint8_t *src, uint8_t *dst, int w, int h, int stride, int bpp)
 {
     int i, x, y;
     int depth = (bpp + 1) >> 3;
@@ -90,8 +91,10 @@ static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, uint8_t *sr
 
 static int decode_frame(AVCodecContext *avctx,
                         void *data, int *data_size,
-                        uint8_t *buf, int buf_size)
+                        AVPacket *avpkt)
 {
+    const uint8_t *buf = avpkt->data;
+    int buf_size = avpkt->size;
     TargaContext * const s = avctx->priv_data;
     AVFrame *picture = data;
     AVFrame * const p= (AVFrame*)&s->picture;
@@ -221,7 +224,7 @@ static int decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-static int targa_init(AVCodecContext *avctx){
+static av_cold int targa_init(AVCodecContext *avctx){
     TargaContext *s = avctx->priv_data;
 
     avcodec_get_frame_defaults((AVFrame*)&s->picture);
@@ -231,7 +234,7 @@ static int targa_init(AVCodecContext *avctx){
     return 0;
 }
 
-static int targa_end(AVCodecContext *avctx){
+static av_cold int targa_end(AVCodecContext *avctx){
     TargaContext *s = avctx->priv_data;
 
     if(s->picture.data[0])
@@ -250,5 +253,6 @@ AVCodec targa_decoder = {
     targa_end,
     decode_frame,
     0,
-    NULL
+    NULL,
+    .long_name = NULL_IF_CONFIG_SMALL("Truevision Targa image"),
 };