add h264 lossless, ru po upd, add ydiff, ffmpeg cmdl/xfer fixes, build upgrades,...
[goodguy/history.git] / cinelerra-5.1 / guicast / vframe.C
index e5d3759724ab1d8c460bd65b1f4806861c17c9cf..e6f0d9d5b9d5d56141c5a4e73399cb5cb137cf3a 100644 (file)
@@ -311,6 +311,7 @@ int VFrame::clear_objects(int do_opengl)
                case BC_YUV410P:
                case BC_YUV411P:
                case BC_YUV420P:
+               case BC_YUV420PI:
                case BC_YUV422P:
                case BC_YUV444P:
                case BC_RGB_FLOATP:
@@ -386,6 +387,7 @@ void VFrame::create_row_pointers()
                break;
 
        case BC_YUV420P:
+       case BC_YUV420PI:
        case BC_YUV411P:
                if( this->v_offset ) break;
                this->y_offset = 0;
@@ -480,6 +482,7 @@ int VFrame::allocate_data(unsigned char *data, int shmid,
                }
                else {
 // Have to use malloc for libpng
+//printf("==vframe %d from %p\n", size, __builtin_return_address(0));
                        this->data = (unsigned char *)malloc(size);
                }
 
@@ -851,6 +854,7 @@ int VFrame::clear_frame()
 
        case BC_YUV411P:
        case BC_YUV420P:
+       case BC_YUV420PI:
                bzero(get_y(), sz);
                bzero(get_u(), sz / 4);
                bzero(get_v(), sz / 4);
@@ -1014,6 +1018,7 @@ int VFrame::copy_from(VFrame *frame)
                        break;
 
                case BC_YUV420P:
+               case BC_YUV420PI:
                case BC_YUV411P:
 //printf("%d %d %p %p %p %p %p %p\n", w, h, get_y(), get_u(), get_v(), frame->get_y(), frame->get_u(), frame->get_v());
                        memcpy(get_y(), frame->get_y(), w * h);
@@ -1050,7 +1055,8 @@ int VFrame::copy_from(VFrame *frame)
 int VFrame::transfer_from(VFrame *that, int bg_color, int in_x, int in_y, int in_w, int in_h)
 {
        if( this->get_color_model() == that->get_color_model() &&
-           this->get_w() == that->get_w() && this->get_h() == that->get_h() )
+           this->get_w() == that->get_w() && this->get_h() == that->get_h() &&
+           this->get_bytes_per_line() == that->get_bytes_per_line() )
                return this->copy_from(that);
 
        timestamp = that->timestamp;
@@ -1063,7 +1069,8 @@ int VFrame::transfer_from(VFrame *that, int bg_color, int in_x, int in_y, int in
                0, 0, this->get_w(), this->get_h(),
                that->get_color_model(), this->get_color_model(), // Color models in/out
                bg_color,                                    // alpha blend bg_color
-               that->get_w(), this->get_w());               // rowspans (of luma for YUV)
+               that->get_bytes_per_line(),
+               this->get_bytes_per_line());                 // rowspans (of luma for YUV)
 #else
        unsigned char *in_ptrs[4], *out_ptrs[4];
        unsigned char **inp, **outp;
@@ -1075,7 +1082,7 @@ int VFrame::transfer_from(VFrame *that, int bg_color, int in_x, int in_y, int in
                inp = in_ptrs;
        }
        else
-               inp = that->get_rows(); 
+               inp = that->get_rows();
        if( BC_CModels::is_planar(this->get_color_model()) ) {
                out_ptrs[0] = this->get_y();
                out_ptrs[1] = this->get_u();
@@ -1084,11 +1091,13 @@ int VFrame::transfer_from(VFrame *that, int bg_color, int in_x, int in_y, int in
                outp = out_ptrs;
        }
        else
-               outp = this->get_rows();        
+               outp = this->get_rows();
        BC_CModels::transfer(outp, this->get_color_model(),
-                       0, 0, this->get_w(), this->get_h(), this->get_w(),
+                       0, 0, this->get_w(), this->get_h(),
+                       this->get_bytes_per_line(),
                inp, that->get_color_model(),
-                       in_x, in_y, in_w, in_h, that->get_w(),
+                       in_x, in_y, in_w, in_h,
+                       that->get_bytes_per_line(),
                bg_color);
 #endif
        return 0;