A decoding apparatus for image decoding, the decoding apparatus comprising: a memory; and at least one processor connected to the memory, the at least one processor configured to: derive a refined L0 motion vector and a refined L1 motion vector by applying decoder-side motion vector refinement, DMVR, based on an L0 motion vector and an L1 motion vector of a current block in a current picture; derive prediction samples for the current block based on L0 prediction samples derived based on the refined L0 motion vector and L1 prediction samples derived based on the refined L1 motion vector; and generate reconstructed samples for the current block based on the prediction samples, wherein the L0 prediction samples are derived based on an L0 reference picture and the refined L0 motion vector, and the L1 prediction samples are derived based on an L1 reference picture and the refined L1 motion vector, wherein the deriving of the prediction samples comprises deriving bidirectional optical flow, BDOF, flag information related to indicating whether to apply BDOF, based on a first BDOF application condition being that a distance between the current picture and the L0 reference picture and a distance between the current picture and the L1 reference picture are the same, wherein the first BDOF application condition is required for setting a value of the BDOF flag information to be a value representing that the BDOF is applied to the current block, wherein the distance between the current picture and the L0 reference picture is specified based on a picture order count, POC, between the current picture and the L0 reference picture, and wherein the distance between the current picture and the L1 reference picture is specified based on a POC between the current picture and the L1 reference picture. a memory; and at least one processor connected to the memory, the at least one processor configured to: derive a refined L0 motion vector and a refined L1 motion vector by applying decoder-side motion vector refinement, DMVR, based on an L0 motion vector and an L1 motion vector of a current block in a current picture; derive prediction samples for the current block based on L0 prediction samples derived based on the refined L0 motion vector and L1 prediction samples derived based on the refined L1 motion vector; and generate reconstructed samples for the current block based on the prediction samples, wherein the L0 prediction samples are derived based on an L0 reference picture and the refined L0 motion vector, and the L1 prediction samples are derived based on an L1 reference picture and the refined L1 motion vector, wherein the deriving of the prediction samples comprises deriving bidirectional optical flow, BDOF, flag information related to indicating whether to apply BDOF, based on a first BDOF application condition being that a distance between the current picture and the L0 reference picture and a distance between the current picture and the L1 reference picture are the same, wherein the first BDOF application condition is required for setting a value of the BDOF flag information to be a value representing that the BDOF is applied to the current block, wherein the distance between the current picture and the L0 reference picture is specified based on a picture order count, POC, between the current picture and the L0 reference picture, and wherein the distance between the current picture and the L1 reference picture is specified based on a POC between the current picture and the L1 reference picture. derive a refined L0 motion vector and a refined L1 motion vector by applying decoder-side motion vector refinement, DMVR, based on an L0 motion vector and an L1 motion vector of a current block in a current picture; derive prediction samples for the current block based on L0 prediction samples derived based on the refined L0 motion vector and L1 prediction samples derived based on the refined L1 motion vector; and generate reconstructed samples for the current block based on the prediction samples, wherein the L0 prediction samples are derived based on an L0 reference picture and the refined L0 motion vector, and the L1 prediction samples are derived based on an L1 reference picture and the refined L1 motion vector, wherein the deriving of the prediction samples comprises deriving bidirectional optical flow, BDOF, flag information related to indicating whether to apply BDOF, based on a first BDOF application condition being that a distance between the current picture and the L0 reference picture and a distance between the current picture and the L1 reference picture are the same, wherein the first BDOF application condition is required for setting a value of the BDOF flag information to be a value representing that the BDOF is applied to the current block, wherein the distance between the current picture and the L0 reference picture is specified based on a picture order count, POC, between the current picture and the L0 reference picture, and wherein the distance between the current picture and the L1 reference picture is specified based on a POC between the current picture and the L1 reference picture.